Skip to content

Commit

Permalink
fix: testMatch not working with negatios
Browse files Browse the repository at this point in the history
  • Loading branch information
thymikee committed Jul 6, 2018
1 parent 664681a commit c93fa8f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/jest-cli/src/__tests__/search_source.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe('SearchSource', () => {
moduleFileExtensions: ['js', 'jsx', 'txt'],
name,
rootDir,
testMatch: ['**/not-really-a-test.txt'],
testMatch: ['**/not-really-a-test.txt', '!**/do-not-match-me.txt'],
testRegex: '',
},
{},
Expand Down
3 changes: 1 addition & 2 deletions packages/jest-cli/src/search_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ const globsToMatcher = (globs: ?Array<Glob>) => {
return () => true;
}

const matchers = globs.map(each => micromatch.matcher(each, {dot: true}));
return path => matchers.some(each => each(path));
return path => micromatch([path], globs, {dot: true}).length > 0;
};

const regexToMatcher = (testRegex: string) => {
Expand Down

0 comments on commit c93fa8f

Please sign in to comment.