From 1d95a4bad95d59ee44aa651f46c9b462670b4ce7 Mon Sep 17 00:00:00 2001 From: Mark Molinaro Date: Thu, 28 Oct 2021 19:22:16 +0000 Subject: [PATCH] Use throwIfNoEntry if available --- packages/jest-resolve/src/fileWalkers.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/jest-resolve/src/fileWalkers.ts b/packages/jest-resolve/src/fileWalkers.ts index 5834f3fad495..c4b5f67d4236 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 not 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;