Skip to content

Commit

Permalink
testMatch should find tests in .folders (jestjs#3006)
Browse files Browse the repository at this point in the history
* testMatch should find tests in .folders

* dont depend on order of paths in tests
  • Loading branch information
zsol authored and skovhus committed Apr 29, 2017
1 parent b7d14ad commit ee3bf08
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/jest-cli/src/SearchSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const globsToMatcher = (globs: ?Array<Glob>) => {
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));
};

Expand Down
10 changes: 6 additions & 4 deletions packages/jest-cli/src/__tests__/SearchSource-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
});
});

Expand All @@ -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());
});
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// not-really-a-test.txt

require('../module.txt');

0 comments on commit ee3bf08

Please sign in to comment.