diff --git a/CHANGELOG.md b/CHANGELOG.md index e3376f7ee7dd..7c8996c10fc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### Fixes - `[jest-config]` Treat `setupFilesAfterEnv` like `setupFiles` when normalizing configs against presets ([#9495](https://github.com/facebook/jest/pull/9495)) +- `[jest-haste-map]` Return correctly from crawler if `readdir` errors ([#9549](https://github.com/facebook/jest/pull/9549)) - `[jest-matcher-utils]` Fix diff highlight of symbol-keyed object. ([#9499](https://github.com/facebook/jest/pull/9499)) - `[jest-resolve]` Fix module identity preservation with symlinks and browser field resolution ([#9511](https://github.com/facebook/jest/pull/9511)) - `[jest-resolve]` Do not confuse directories with files ([#8912](https://github.com/facebook/jest/pull/8912)) diff --git a/packages/jest-haste-map/src/crawlers/node.ts b/packages/jest-haste-map/src/crawlers/node.ts index 833f51f80f14..ac1474e96280 100644 --- a/packages/jest-haste-map/src/crawlers/node.ts +++ b/packages/jest-haste-map/src/crawlers/node.ts @@ -35,7 +35,9 @@ function find( fs.readdir(directory, {withFileTypes: true}, (err, entries) => { activeCalls--; if (err) { - callback(result); + if (activeCalls === 0) { + callback(result); + } return; } // node < v10.10 does not support the withFileTypes option, and