fix(test): swallow EPERM on Windows temp dir cleanup in auto-stash-merge test

Windows CI runners hold git file locks that prevent rmSync from removing
temp repos in finally blocks. Wrap cleanup in try-catch so a cleanup
failure doesn't fail the actual test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson 2026-03-24 15:08:06 -06:00
parent cc48cc9435
commit adfea1769d

View file

@ -83,7 +83,7 @@ test("#2151 bug 1: auto-stash unblocks merge when unrelated files are dirty", ()
const readmeContent = readFileSync(join(repo, "README.md"), "utf-8");
assert.equal(readmeContent, "# modified locally\n", "stash popped — dirty file restored after merge");
} finally {
rmSync(repo, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
try { rmSync(repo, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } catch { /* Windows EPERM: git holds locks on .git files */ }
}
});
@ -116,6 +116,6 @@ test("#2151 bug 2: nativeMergeSquash returns dirty filenames", async () => {
);
} finally {
run("git checkout -- . 2>/dev/null || true", repo);
rmSync(repo, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
try { rmSync(repo, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } catch { /* Windows EPERM: git holds locks on .git files */ }
}
});