File tree Expand file tree Collapse file tree 1 file changed +17
-12
lines changed
Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -96,21 +96,26 @@ var hasImport = require('has-dynamic-import');
9696var tape = require ( '../' ) ;
9797
9898function importFiles ( hasSupport ) {
99- if ( ! hasSupport ) {
100- return files . forEach ( function ( x ) { require ( x ) ; } ) ;
101- }
102-
103- var importOrRequire = require ( './import-or-require' ) ;
104-
10599 tape . wait ( ) ;
106100
107- var filesPromise = files . reduce ( function ( promise , file ) {
108- return promise ? promise . then ( function ( ) {
109- return importOrRequire ( file ) ;
110- } ) : importOrRequire ( file ) ;
111- } , null ) ;
101+ var filesPromise ;
102+ if ( hasSupport ) {
103+ var importOrRequire = require ( './import-or-require' ) ;
104+
105+ filesPromise = files . reduce ( function ( promise , file ) {
106+ return promise ? promise . then ( function ( ) {
107+ return importOrRequire ( file ) ;
108+ } ) : importOrRequire ( file ) ;
109+ } , null ) ;
110+ } else {
111+ files . forEach ( function ( x ) { require ( x ) ; } ) ;
112+ }
112113
113- return filesPromise ? filesPromise . then ( function ( ) { tape . run ( ) ; } ) : tape . run ( ) ;
114+ if ( filesPromise ) {
115+ filesPromise . then ( function ( ) { tape . run ( ) ; } ) ;
116+ } else {
117+ tape . run ( ) ;
118+ }
114119}
115120
116121hasImport ( ) . then ( function ( hasSupport ) {
You can’t perform that action at this time.
0 commit comments