From 9e94c5e037681668ea46dc846faf3537728f63dc Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 19 Sep 2023 07:50:59 +0200 Subject: [PATCH] fix tests --- packages/jest-resolve/src/fileWalkers.ts | 9 ++++++++- .../src/__tests__/runtime_require_module.test.js | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/jest-resolve/src/fileWalkers.ts b/packages/jest-resolve/src/fileWalkers.ts index 50777ba0fa50..6821310439fb 100644 --- a/packages/jest-resolve/src/fileWalkers.ts +++ b/packages/jest-resolve/src/fileWalkers.ts @@ -28,7 +28,14 @@ function statSyncCached(path: string): IPathType { return result; } - const stat = fs.statSync(path, {throwIfNoEntry: false}); + let stat; + try { + stat = fs.statSync(path, {throwIfNoEntry: false}); + } catch (e: any) { + if (!(e && (e.code === 'ENOENT' || e.code === 'ENOTDIR'))) { + throw e; + } + } if (stat) { if (stat.isFile() || stat.isFIFO()) { diff --git a/packages/jest-runtime/src/__tests__/runtime_require_module.test.js b/packages/jest-runtime/src/__tests__/runtime_require_module.test.js index 639e4c4503f5..46bd064769e8 100644 --- a/packages/jest-runtime/src/__tests__/runtime_require_module.test.js +++ b/packages/jest-runtime/src/__tests__/runtime_require_module.test.js @@ -41,6 +41,7 @@ describe('Runtime requireModule', () => { 'exports', 'filename', 'id', + 'isPreloading', 'loaded', 'path', 'parent', @@ -60,6 +61,7 @@ describe('Runtime requireModule', () => { 'exports', 'filename', 'id', + 'isPreloading', 'loaded', 'path', 'parent',