diff --git a/packages/jest-cli/src/SearchSource.js b/packages/jest-cli/src/SearchSource.js index 26942da347ee..5afb4940c178 100644 --- a/packages/jest-cli/src/SearchSource.js +++ b/packages/jest-cli/src/SearchSource.js @@ -77,7 +77,7 @@ const globsToMatcher = (globs: ?Array) => { return () => true; } - const matchers = globs.map(each => micromatch.matcher(each)); + const matchers = globs.map(each => micromatch.matcher(each, {dot: true})); return (path: Path) => matchers.some(each => each(path)); }; diff --git a/packages/jest-cli/src/__tests__/SearchSource-test.js b/packages/jest-cli/src/__tests__/SearchSource-test.js index f74afb1ddd8b..8a7a3f349202 100644 --- a/packages/jest-cli/src/__tests__/SearchSource-test.js +++ b/packages/jest-cli/src/__tests__/SearchSource-test.js @@ -108,10 +108,11 @@ describe('SearchSource', () => { return findMatchingTests(config).then(data => { const relPaths = data.paths.map(absPath => ( path.relative(rootDir, absPath) - )); + )).sort(); expect(relPaths).toEqual([ + path.normalize('.hiddenFolder/not-really-a-test.txt'), path.normalize('__testtests__/not-really-a-test.txt'), - ]); + ].sort()); }); }); @@ -126,10 +127,11 @@ describe('SearchSource', () => { return findMatchingTests(config).then(data => { const relPaths = data.paths.map(absPath => ( path.relative(rootDir, absPath) - )); + )).sort(); expect(relPaths).toEqual([ + path.normalize('.hiddenFolder/not-really-a-test.txt'), path.normalize('__testtests__/not-really-a-test.txt'), - ]); + ].sort()); }); }); diff --git a/packages/jest-cli/src/__tests__/test_root/.hiddenFolder/not-really-a-test.txt b/packages/jest-cli/src/__tests__/test_root/.hiddenFolder/not-really-a-test.txt new file mode 100644 index 000000000000..6d2dba7f4d4a --- /dev/null +++ b/packages/jest-cli/src/__tests__/test_root/.hiddenFolder/not-really-a-test.txt @@ -0,0 +1,3 @@ +// not-really-a-test.txt + +require('../module.txt');