Skip to content

Commit

Permalink
feat(jest-haste-map): Enable crawling for symlink test files
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmeku committed Dec 30, 2019
1 parent 9419034 commit 3888ea9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Features

- `[jest-haste-map]` Enable crawling for symlink test files ([#9350](https://github.com/facebook/jest/issues/9350))
- `[babel-plugin-jest-hoist]` Show codeframe on static hoisting issues ([#8865](https://github.com/facebook/jest/pull/8865))
- `[babel-plugin-jest-hoist]` Add `BigInt` to `WHITELISTED_IDENTIFIERS` ([#8382](https://github.com/facebook/jest/pull/8382))
- `[babel-preset-jest]` Add `@babel/plugin-syntax-bigint` ([#8382](https://github.com/facebook/jest/pull/8382))
Expand Down
5 changes: 5 additions & 0 deletions packages/jest-haste-map/src/crawlers/__tests__/node.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,13 @@ describe('node crawler', () => {
expect(childProcess.spawn).lastCalledWith('find', [
'/project/fruits',
'/project/vegtables',
'(',
'-type',
'f',
'-o',
'-type',
'l',
')',
'(',
'-iname',
'*.js',
Expand Down
6 changes: 4 additions & 2 deletions packages/jest-haste-map/src/crawlers/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ function findNative(
callback: Callback,
): void {
const args = Array.from(roots);
args.push('-type', 'f');
args.push('(', '-type', 'f', '-o', '-type', 'l', ')');

if (extensions.length) {
args.push('(');
}
Expand Down Expand Up @@ -121,7 +122,8 @@ function findNative(
} else {
lines.forEach(path => {
fs.stat(path, (err, stat) => {
if (!err && stat) {
// Filter out symlinks that describe directories
if (!err && stat && !stat.isDirectory()) {
result.push([path, stat.mtime.getTime(), stat.size]);
}
if (--count === 0) {
Expand Down

0 comments on commit 3888ea9

Please sign in to comment.