From 2c2d59b84d489f565574c17132a6953001dce6f1 Mon Sep 17 00:00:00 2001 From: Luke Page Date: Wed, 19 May 2021 07:57:59 +0200 Subject: [PATCH] Additional fix for #4444 to prevent errors on windows --- packages/jest-transform/src/ScriptTransformer.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/jest-transform/src/ScriptTransformer.ts b/packages/jest-transform/src/ScriptTransformer.ts index dca4aa3492ba..f15cf8304e86 100644 --- a/packages/jest-transform/src/ScriptTransformer.ts +++ b/packages/jest-transform/src/ScriptTransformer.ts @@ -933,6 +933,12 @@ const readCacheFile = (cachePath: Config.Path): string | null => { try { fileData = fs.readFileSync(cachePath, 'utf8'); } catch (e) { + // on windows write-file-atomic is not atomic which can + // result in this error + if (e.code === 'ENOENT' && process.platform === 'win32') { + return null; + } + e.message = 'jest: failed to read cache file: ' + cachePath +