Skip to content

Commit

Permalink
Filter new files before they're added.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbainter committed Jan 18, 2018
1 parent 5c9547b commit db0d1fd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bin/_mocha
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit db0d1fd

Please sign in to comment.