Skip to content

Commit 6a1ce43

Browse files
committedAug 16, 2022
[New] bin/tape: include the exact arg when there are no glob results; use require on --require files
1 parent fbdbfc9 commit 6a1ce43

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed
 

Diff for: ‎bin/tape

+9-6
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,17 @@ if (typeof opts.ignore === 'string') {
4848
var glob = require('glob');
4949

5050
opts._.reduce(function (result, arg) {
51-
// If glob does not match, `files` will be an empty array. Note: `glob.sync` may throw an error and crash the node process.
52-
var files = glob.sync(arg);
51+
if (glob.hasMagic(arg)) {
52+
// If glob does not match, `files` will be an empty array. Note: `glob.sync` may throw an error and crash the node process.
53+
var files = glob.sync(arg);
5354

54-
if (!Array.isArray(files)) {
55-
throw new TypeError('unknown error: glob.sync did not return an array or throw. Please report this.');
56-
}
55+
if (!Array.isArray(files)) {
56+
throw new TypeError('unknown error: glob.sync did not return an array or throw. Please report this.');
57+
}
5758

58-
return result.concat(files);
59+
return result.concat(files);
60+
}
61+
return result.concat(arg);
5962
}, []).filter(function (file) {
6063
return !matcher || !matcher.shouldIgnore(file);
6164
}).forEach(function (file) {

0 commit comments

Comments
 (0)
Please sign in to comment.