Skip to content

Commit

Permalink
Additional fix for #4444 to prevent errors on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeapage committed May 19, 2021
1 parent 2047a36 commit 2c2d59b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/jest-transform/src/ScriptTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 +
Expand Down

0 comments on commit 2c2d59b

Please sign in to comment.