From 11d79ec096a25851124356095d60352f6ca2824e Mon Sep 17 00:00:00 2001 From: Mark Molinaro Date: Wed, 5 Jan 2022 23:52:11 -0800 Subject: [PATCH] perf(jest-resolve): skip error creation on not found stat calls (#11749) * perf(jest-resolve): skip error creation on not found stat calls * dedupe Co-authored-by: Simen Bekkhus --- CHANGELOG.md | 4 +++ package.json | 2 +- packages/babel-jest/package.json | 2 +- packages/jest-circus/package.json | 2 +- packages/jest-cli/package.json | 2 +- packages/jest-config/package.json | 2 +- packages/jest-core/package.json | 2 +- packages/jest-haste-map/package.json | 2 +- packages/jest-message-util/package.json | 2 +- packages/jest-reporters/package.json | 2 +- packages/jest-resolve/package.json | 2 +- packages/jest-resolve/src/fileWalkers.ts | 3 +- packages/jest-runner/package.json | 2 +- packages/jest-runtime/package.json | 2 +- packages/jest-serializer/package.json | 2 +- packages/jest-snapshot/package.json | 2 +- packages/jest-source-map/package.json | 2 +- packages/jest-test-sequencer/package.json | 2 +- packages/jest-transform/package.json | 2 +- packages/jest-util/package.json | 2 +- yarn.lock | 44 +++++++++++------------ 21 files changed, 46 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbbd0a9def01..2cdded6df47d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,12 @@ ### Chore & Maintenance +- `[*]` Update graceful-fs to ^4.2.9 ([#11749](https://github.com/facebook/jest/pull/11749)) + ### Performance +- `[jest-resolve]` perf: skip error creation on not found stat calls ([#11749](https://github.com/facebook/jest/pull/11749)) + ## 27.4.7 ### Fixes diff --git a/package.json b/package.json index 50722a15bb2b..fa288cf2d1b1 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "find-process": "^1.4.1", "glob": "^7.1.1", "globby": "^11.0.0", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "isbinaryfile": "^4.0.0", "istanbul-lib-coverage": "^3.0.0", "istanbul-lib-report": "^3.0.0", diff --git a/packages/babel-jest/package.json b/packages/babel-jest/package.json index aee537ce5b66..35a691867ff0 100644 --- a/packages/babel-jest/package.json +++ b/packages/babel-jest/package.json @@ -24,7 +24,7 @@ "babel-plugin-istanbul": "^6.1.1", "babel-preset-jest": "^27.4.0", "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "slash": "^3.0.0" }, "devDependencies": { diff --git a/packages/jest-circus/package.json b/packages/jest-circus/package.json index 118daa8b47b7..6e467949da07 100644 --- a/packages/jest-circus/package.json +++ b/packages/jest-circus/package.json @@ -46,7 +46,7 @@ "@types/graceful-fs": "^4.1.3", "@types/stack-utils": "^2.0.0", "execa": "^5.0.0", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "jest-snapshot-serializer-raw": "^1.1.0" }, "engines": { diff --git a/packages/jest-cli/package.json b/packages/jest-cli/package.json index 89b104fc1881..a933f9aa099c 100644 --- a/packages/jest-cli/package.json +++ b/packages/jest-cli/package.json @@ -18,7 +18,7 @@ "@jest/types": "^27.4.2", "chalk": "^4.0.0", "exit": "^0.1.2", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "import-local": "^3.0.2", "jest-config": "^27.4.7", "jest-util": "^27.4.2", diff --git a/packages/jest-config/package.json b/packages/jest-config/package.json index 4c2c601828f9..05f9bd0de759 100644 --- a/packages/jest-config/package.json +++ b/packages/jest-config/package.json @@ -33,7 +33,7 @@ "ci-info": "^3.2.0", "deepmerge": "^4.2.2", "glob": "^7.1.1", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "jest-circus": "^27.4.6", "jest-environment-jsdom": "^27.4.6", "jest-environment-node": "^27.4.6", diff --git a/packages/jest-core/package.json b/packages/jest-core/package.json index 4b8cf521e94b..0e602f186af3 100644 --- a/packages/jest-core/package.json +++ b/packages/jest-core/package.json @@ -22,7 +22,7 @@ "chalk": "^4.0.0", "emittery": "^0.8.1", "exit": "^0.1.2", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "jest-changed-files": "^27.4.2", "jest-config": "^27.4.7", "jest-haste-map": "^27.4.6", diff --git a/packages/jest-haste-map/package.json b/packages/jest-haste-map/package.json index 4d64dd7fdbc1..7904f9f53d2e 100644 --- a/packages/jest-haste-map/package.json +++ b/packages/jest-haste-map/package.json @@ -22,7 +22,7 @@ "@types/node": "*", "anymatch": "^3.0.3", "fb-watchman": "^2.0.0", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "jest-regex-util": "^27.4.0", "jest-serializer": "^27.4.0", "jest-util": "^27.4.2", diff --git a/packages/jest-message-util/package.json b/packages/jest-message-util/package.json index e4dd21c13509..ebafeae873b2 100644 --- a/packages/jest-message-util/package.json +++ b/packages/jest-message-util/package.json @@ -24,7 +24,7 @@ "@jest/types": "^27.4.2", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "micromatch": "^4.0.4", "pretty-format": "^27.4.6", "slash": "^3.0.0", diff --git a/packages/jest-reporters/package.json b/packages/jest-reporters/package.json index 73c628f58e6c..c8ff589744b2 100644 --- a/packages/jest-reporters/package.json +++ b/packages/jest-reporters/package.json @@ -22,7 +22,7 @@ "collect-v8-coverage": "^1.0.0", "exit": "^0.1.2", "glob": "^7.1.2", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "istanbul-lib-coverage": "^3.0.0", "istanbul-lib-instrument": "^5.1.0", "istanbul-lib-report": "^3.0.0", diff --git a/packages/jest-resolve/package.json b/packages/jest-resolve/package.json index 82e046421f35..ac31a3289c68 100644 --- a/packages/jest-resolve/package.json +++ b/packages/jest-resolve/package.json @@ -19,7 +19,7 @@ "dependencies": { "@jest/types": "^27.4.2", "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "jest-haste-map": "^27.4.6", "jest-pnp-resolver": "^1.2.2", "jest-util": "^27.4.2", diff --git a/packages/jest-resolve/src/fileWalkers.ts b/packages/jest-resolve/src/fileWalkers.ts index 5834f3fad495..2b7fc52555d4 100644 --- a/packages/jest-resolve/src/fileWalkers.ts +++ b/packages/jest-resolve/src/fileWalkers.ts @@ -30,7 +30,8 @@ function statSyncCached(path: string): IPathType { let stat; try { - stat = fs.statSync(path); + // @ts-expect-error TS2554 - throwIfNoEntry is only available in recent version of node, but inclusion of the option is a backward compatible no-op. + stat = fs.statSync(path, {throwIfNoEntry: false}); } catch (e: any) { if (!(e && (e.code === 'ENOENT' || e.code === 'ENOTDIR'))) { throw e; diff --git a/packages/jest-runner/package.json b/packages/jest-runner/package.json index 392d441e482d..62438ab39f10 100644 --- a/packages/jest-runner/package.json +++ b/packages/jest-runner/package.json @@ -26,7 +26,7 @@ "chalk": "^4.0.0", "emittery": "^0.8.1", "exit": "^0.1.2", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "jest-docblock": "^27.4.0", "jest-environment-jsdom": "^27.4.6", "jest-environment-node": "^27.4.6", diff --git a/packages/jest-runtime/package.json b/packages/jest-runtime/package.json index 1dbdc6137f55..d74d4a0f6ae9 100644 --- a/packages/jest-runtime/package.json +++ b/packages/jest-runtime/package.json @@ -29,7 +29,7 @@ "collect-v8-coverage": "^1.0.0", "execa": "^5.0.0", "glob": "^7.1.3", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "jest-haste-map": "^27.4.6", "jest-message-util": "^27.4.6", "jest-mock": "^27.4.6", diff --git a/packages/jest-serializer/package.json b/packages/jest-serializer/package.json index c0d1911b410f..180866816f53 100644 --- a/packages/jest-serializer/package.json +++ b/packages/jest-serializer/package.json @@ -11,7 +11,7 @@ }, "dependencies": { "@types/node": "*", - "graceful-fs": "^4.2.4" + "graceful-fs": "^4.2.9" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" diff --git a/packages/jest-snapshot/package.json b/packages/jest-snapshot/package.json index d17a995e8002..c24c02a5cf97 100644 --- a/packages/jest-snapshot/package.json +++ b/packages/jest-snapshot/package.json @@ -29,7 +29,7 @@ "babel-preset-current-node-syntax": "^1.0.0", "chalk": "^4.0.0", "expect": "^27.4.6", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "jest-diff": "^27.4.6", "jest-get-type": "^27.4.0", "jest-haste-map": "^27.4.6", diff --git a/packages/jest-source-map/package.json b/packages/jest-source-map/package.json index f86b7cb16cb4..c695b70727ae 100644 --- a/packages/jest-source-map/package.json +++ b/packages/jest-source-map/package.json @@ -18,7 +18,7 @@ }, "dependencies": { "callsites": "^3.0.0", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "source-map": "^0.6.0" }, "devDependencies": { diff --git a/packages/jest-test-sequencer/package.json b/packages/jest-test-sequencer/package.json index 2f80e55e3928..51b619c5b08e 100644 --- a/packages/jest-test-sequencer/package.json +++ b/packages/jest-test-sequencer/package.json @@ -18,7 +18,7 @@ }, "dependencies": { "@jest/test-result": "^27.4.6", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "jest-haste-map": "^27.4.6", "jest-runtime": "^27.4.6" }, diff --git a/packages/jest-transform/package.json b/packages/jest-transform/package.json index 7ad087e661c6..f8fd12ce9721 100644 --- a/packages/jest-transform/package.json +++ b/packages/jest-transform/package.json @@ -23,7 +23,7 @@ "chalk": "^4.0.0", "convert-source-map": "^1.4.0", "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "jest-haste-map": "^27.4.6", "jest-regex-util": "^27.4.0", "jest-util": "^27.4.2", diff --git a/packages/jest-util/package.json b/packages/jest-util/package.json index 547d7b7a3830..27dbc74af579 100644 --- a/packages/jest-util/package.json +++ b/packages/jest-util/package.json @@ -21,7 +21,7 @@ "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "picomatch": "^2.2.3" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 73eef1529ce9..6b062a586442 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2504,7 +2504,7 @@ __metadata: chalk: ^4.0.0 emittery: ^0.8.1 exit: ^0.1.2 - graceful-fs: ^4.2.4 + graceful-fs: ^4.2.9 jest-changed-files: ^27.4.2 jest-config: ^27.4.7 jest-haste-map: ^27.4.6 @@ -2624,7 +2624,7 @@ __metadata: find-process: ^1.4.1 glob: ^7.1.1 globby: ^11.0.0 - graceful-fs: ^4.2.4 + graceful-fs: ^4.2.9 isbinaryfile: ^4.0.0 istanbul-lib-coverage: ^3.0.0 istanbul-lib-report: ^3.0.0 @@ -2688,7 +2688,7 @@ __metadata: collect-v8-coverage: ^1.0.0 exit: ^0.1.2 glob: ^7.1.2 - graceful-fs: ^4.2.4 + graceful-fs: ^4.2.9 istanbul-lib-coverage: ^3.0.0 istanbul-lib-instrument: ^5.1.0 istanbul-lib-report: ^3.0.0 @@ -2719,7 +2719,7 @@ __metadata: dependencies: "@types/graceful-fs": ^4.1.2 callsites: ^3.0.0 - graceful-fs: ^4.2.4 + graceful-fs: ^4.2.9 source-map: ^0.6.0 languageName: unknown linkType: soft @@ -2741,7 +2741,7 @@ __metadata: dependencies: "@jest/test-result": ^27.4.6 "@types/graceful-fs": ^4.1.3 - graceful-fs: ^4.2.4 + graceful-fs: ^4.2.9 jest-haste-map: ^27.4.6 jest-runtime: ^27.4.6 languageName: unknown @@ -2779,7 +2779,7 @@ __metadata: convert-source-map: ^1.4.0 dedent: ^0.7.0 fast-json-stable-stringify: ^2.0.0 - graceful-fs: ^4.2.4 + graceful-fs: ^4.2.9 jest-haste-map: ^27.4.6 jest-regex-util: ^27.4.0 jest-snapshot-serializer-raw: ^1.1.0 @@ -6308,7 +6308,7 @@ __metadata: babel-plugin-istanbul: ^6.1.1 babel-preset-jest: ^27.4.0 chalk: ^4.0.0 - graceful-fs: ^4.2.4 + graceful-fs: ^4.2.9 slash: ^3.0.0 peerDependencies: "@babel/core": ^7.8.0 @@ -10957,10 +10957,10 @@ __metadata: languageName: node linkType: hard -"graceful-fs@npm:^4.1.11, graceful-fs@npm:^4.1.15, graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.3, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.1.9, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.2, graceful-fs@npm:^4.2.3, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6": - version: 4.2.8 - resolution: "graceful-fs@npm:4.2.8" - checksum: b07e032c0a17e928d3e8ab0f0fea1492efd4568b55a3d2675aaaccf1619eca91156edfa0cb05e99b923e24edf5e26fdce22ffa58ec14d5b13a3b1392460f37f0 +"graceful-fs@npm:^4.1.11, graceful-fs@npm:^4.1.15, graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.3, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.1.9, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.2, graceful-fs@npm:^4.2.3, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": + version: 4.2.9 + resolution: "graceful-fs@npm:4.2.9" + checksum: e0382eb1aab9d04d8dbf0faed61987145cf876548138ff660553168b1ff04e6c65ee407aca102a0047bb2144845261c4a8a5f65934842f64acf12d3a8fd711ba languageName: node linkType: hard @@ -12612,7 +12612,7 @@ __metadata: dedent: ^0.7.0 execa: ^5.0.0 expect: ^27.4.6 - graceful-fs: ^4.2.4 + graceful-fs: ^4.2.9 is-generator-fn: ^2.0.0 jest-each: ^27.4.6 jest-matcher-utils: ^27.4.6 @@ -12641,7 +12641,7 @@ __metadata: "@types/yargs": ^16.0.0 chalk: ^4.0.0 exit: ^0.1.2 - graceful-fs: ^4.2.4 + graceful-fs: ^4.2.9 import-local: ^3.0.2 jest-config: ^27.4.7 jest-util: ^27.4.2 @@ -12673,7 +12673,7 @@ __metadata: ci-info: ^3.2.0 deepmerge: ^4.2.2 glob: ^7.1.1 - graceful-fs: ^4.2.4 + graceful-fs: ^4.2.9 jest-circus: ^27.4.6 jest-environment-jsdom: ^27.4.6 jest-environment-node: ^27.4.6 @@ -12818,7 +12818,7 @@ __metadata: anymatch: ^3.0.3 fb-watchman: ^2.0.0 fsevents: ^2.3.2 - graceful-fs: ^4.2.4 + graceful-fs: ^4.2.9 jest-regex-util: ^27.4.0 jest-serializer: ^27.4.0 jest-snapshot-serializer-raw: ^1.1.0 @@ -12930,7 +12930,7 @@ __metadata: "@types/micromatch": ^4.0.1 "@types/stack-utils": ^2.0.0 chalk: ^4.0.0 - graceful-fs: ^4.2.4 + graceful-fs: ^4.2.9 micromatch: ^4.0.4 pretty-format: ^27.4.6 slash: ^3.0.0 @@ -13027,7 +13027,7 @@ __metadata: "@types/graceful-fs": ^4.1.3 "@types/resolve": ^1.20.0 chalk: ^4.0.0 - graceful-fs: ^4.2.4 + graceful-fs: ^4.2.9 jest-haste-map: ^27.4.6 jest-pnp-resolver: ^1.2.2 jest-util: ^27.4.2 @@ -13065,7 +13065,7 @@ __metadata: chalk: ^4.0.0 emittery: ^0.8.1 exit: ^0.1.2 - graceful-fs: ^4.2.4 + graceful-fs: ^4.2.9 jest-docblock: ^27.4.0 jest-environment-jsdom: ^27.4.6 jest-environment-node: ^27.4.6 @@ -13102,7 +13102,7 @@ __metadata: collect-v8-coverage: ^1.0.0 execa: ^5.0.0 glob: ^7.1.3 - graceful-fs: ^4.2.4 + graceful-fs: ^4.2.9 jest-environment-node: ^27.4.6 jest-haste-map: ^27.4.6 jest-message-util: ^27.4.6 @@ -13123,7 +13123,7 @@ __metadata: dependencies: "@types/graceful-fs": ^4.1.3 "@types/node": "*" - graceful-fs: ^4.2.4 + graceful-fs: ^4.2.9 languageName: unknown linkType: soft @@ -13178,7 +13178,7 @@ __metadata: babel-preset-current-node-syntax: ^1.0.0 chalk: ^4.0.0 expect: ^27.4.6 - graceful-fs: ^4.2.4 + graceful-fs: ^4.2.9 jest-diff: ^27.4.6 jest-get-type: ^27.4.0 jest-haste-map: ^27.4.6 @@ -13203,7 +13203,7 @@ __metadata: "@types/picomatch": ^2.2.2 chalk: ^4.0.0 ci-info: ^3.2.0 - graceful-fs: ^4.2.4 + graceful-fs: ^4.2.9 picomatch: ^2.2.3 languageName: unknown linkType: soft