Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## master

## jest 22.1.1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove this line, we'll add version number on publish


### Fixes

* `[jest-cli]` Fix `EISDIR` when a directory is passed as an argument to `jest`.
([#5317](https://github.com/facebook/jest/pull/5317))

## jest 22.1.0

### Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ exports[`CLI accepts exact filenames 2`] = `
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: <<REPLACED>>
Ran all test suites matching /.\\\\/bar.js|.\\\\/foo\\\\/baz.js/i.
Ran all test suites matching /.\\\\/bar.js|.\\\\/foo\\\\/baz.js|.\\\\/foo/i.
"
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ test('CLI accepts exact filenames', () => {
'--forceExit',
'./bar.js',
'./foo/baz.js',
'./foo',
]);
const {rest, summary} = extractSummary(stderr);
expect(status).toBe(0);
Expand Down
4 changes: 3 additions & 1 deletion packages/jest-cli/src/search_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ export default class SearchSource {
} else if (globalConfig.findRelatedTests && paths && paths.length) {
return Promise.resolve(this.findRelatedTestsFromPattern(paths));
} else {
const validTestPaths = paths && paths.filter(fs.existsSync);
const validTestPaths =
paths &&
paths.filter(fs.existsSync).filter(name => fs.lstatSync(name).isFile());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about

    const validTestPaths =
        paths &&
        paths.filter(name => {
            try {
                return fs.lstatSync(name).isFile();
            } catch (e) {
                return false;
            }
        });

to at least save a single FS operation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call; fixed


if (validTestPaths && validTestPaths.length) {
return Promise.resolve({tests: toTests(this._context, validTestPaths)});
Expand Down