Skip to content

Commit 51597e2

Browse files
authored
Merge pull request #374 from feross/master
Fix spurious "test exited without ending"
2 parents 1a8e936 + b06f914 commit 51597e2

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Diff for: bin/tape

+10-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,16 @@ opts.require.forEach(function(module) {
2626
});
2727

2828
opts._.forEach(function (arg) {
29-
glob(arg, function (err, files) {
30-
files.forEach(function (file) {
31-
require(resolvePath(cwd, file));
32-
});
29+
// If glob does not match, `files` will be an empty array.
30+
// Note: `glob.sync` may throw an error and crash the node process.
31+
var files = glob.sync(arg);
32+
33+
if (!Array.isArray(files)) {
34+
throw new TypeError('unknown error: glob.sync did not return an array or throw. Please report this.');
35+
}
36+
37+
files.forEach(function (file) {
38+
require(resolvePath(cwd, file));
3339
});
3440
});
3541

0 commit comments

Comments
 (0)