From db0d1fd0fa225843fa2076854187f8bfd1f2e7e4 Mon Sep 17 00:00:00 2001 From: metalex9 Date: Wed, 17 Jan 2018 20:53:59 -0600 Subject: [PATCH] Filter new files before they're added. --- bin/_mocha | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/_mocha b/bin/_mocha index be76e61b8b..e93909c66b 100755 --- a/bin/_mocha +++ b/bin/_mocha @@ -496,8 +496,14 @@ args.forEach(arg => { throw err; } - files = files.concat(newFiles) - .filter(fileName => program.exclude.every(pattern => !minimatch(fileName, pattern))); + if (typeof newFiles !== 'undefined') { + if (typeof newFiles === 'string') { + newFiles = [newFiles]; + } + newFiles = newFiles.filter(fileName => program.exclude.every(pattern => !minimatch(fileName, pattern))); + } + + files = files.concat(newFiles); }); if (!files.length) {