diff --git a/bin/tape b/bin/tape index 84f0f0ec..f774228f 100755 --- a/bin/tape +++ b/bin/tape @@ -47,7 +47,7 @@ if (typeof opts.ignore === 'string') { var glob = require('glob'); -opts._.forEach(function (arg) { +opts._.reduce(function (result, arg) { // If glob does not match, `files` will be an empty array. Note: `glob.sync` may throw an error and crash the node process. var files = glob.sync(arg); @@ -55,9 +55,11 @@ opts._.forEach(function (arg) { throw new TypeError('unknown error: glob.sync did not return an array or throw. Please report this.'); } - files.filter(function (file) { return !matcher || !matcher.shouldIgnore(file); }).forEach(function (file) { - require(resolvePath(cwd, file)); - }); + return result.concat(files); +}, []).filter(function (file) { + return !matcher || !matcher.shouldIgnore(file); +}).forEach(function (file) { + require(resolvePath(cwd, file)); }); // vim: ft=javascript