Skip to content

Commit e046fb3

Browse files
committed
test(e2e): retry temp-dir removal in cleanup to absorb daemon-exit races
The after-each cleanup can race a just-stopped daemon still flushing files under the temporary HOME, failing the suite with ENOTEMPTY even though the test itself passed. Retry the recursive removal with rmSync's built-in maxRetries/retryDelay instead of failing the hook.
1 parent bb4af83 commit e046fb3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tests/e2e/helpers/e2e-harness.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ function cleanupE2ERepo(env) {
9090
if (!env) return;
9191
for (const dir of [env.repoDir, env.homeDir, env.binDir, env.originDir]) {
9292
if (dir && fs.existsSync(dir)) {
93-
fs.rmSync(dir, { recursive: true, force: true });
93+
// A just-stopped daemon can still be flushing files under the temp HOME
94+
// while this removal walks it, surfacing as ENOTEMPTY/EBUSY; retry the
95+
// removal instead of failing the suite in the after-each hook.
96+
fs.rmSync(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
9497
}
9598
}
9699
}

0 commit comments

Comments
 (0)