Skip to content

Commit 2d5c8dc

Browse files
committed
[Fix] in engines that lack dynamic import, have some output
1 parent 627d1e7 commit 2d5c8dc

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

bin/tape

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,26 @@ var hasImport = require('has-dynamic-import');
9696
var tape = require('../');
9797

9898
function 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

116121
hasImport().then(function (hasSupport) {

0 commit comments

Comments
 (0)