Skip to content

Commit 1aeb8eb

Browse files
lukeapagecpojer
andauthored
Prevent EPERM windows transform issue from failing tests (#11104)
Co-authored-by: Christoph Nakazawa <[email protected]>
1 parent 73c5fe9 commit 1aeb8eb

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

packages/jest-transform/src/ScriptTransformer.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -954,14 +954,13 @@ const writeCacheFile = (cachePath: string, fileData: string) => {
954954
* processes attempt to rename to the same target file at the same time.
955955
* If the target file exists we can be reasonably sure another process has
956956
* legitimately won a cache write race and ignore the error.
957+
* If the target does not exist we do not know if it is because it is still
958+
* being written by another process or is being overwritten by another process.
957959
*/
958960
const cacheWriteErrorSafeToIgnore = (
959961
e: NodeJS.ErrnoException,
960962
cachePath: string,
961-
) =>
962-
process.platform === 'win32' &&
963-
e.code === 'EPERM' &&
964-
fs.existsSync(cachePath);
963+
) => process.platform === 'win32' && e.code === 'EPERM';
965964

966965
const readCacheFile = (cachePath: string): string | null => {
967966
if (!fs.existsSync(cachePath)) {

0 commit comments

Comments
 (0)