fix(tests): wrap rmSync cleanup in try/catch for Windows EPERM
maxRetries doesn't help with EPERM (only EBUSY/EMFILE/ENFILE). Windows holds directory handles after close, making rmSync fail in afterEach. Swallowing the error is safe — OS cleans temp dirs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6923ddd519
commit
e35bc2fe15
8 changed files with 15 additions and 15 deletions
|
|
@ -36,7 +36,7 @@ afterEach(() => {
|
|||
process.chdir(savedCwd);
|
||||
}
|
||||
for (const d of tmpDirs) {
|
||||
rmSync(d, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
||||
try { rmSync(d, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } catch { /* Windows EPERM */ }
|
||||
}
|
||||
tmpDirs.length = 0;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ function makeTmpDir(): string {
|
|||
afterEach(() => {
|
||||
_resetPendingResolve();
|
||||
for (const d of tmpDirs) {
|
||||
rmSync(d, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
||||
try { rmSync(d, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } catch { /* Windows EPERM — OS cleans up temp dirs */ }
|
||||
}
|
||||
tmpDirs.length = 0;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ function makeTmpDir(): string {
|
|||
|
||||
afterEach(() => {
|
||||
for (const d of tmpDirs) {
|
||||
rmSync(d, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
||||
try { rmSync(d, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } catch { /* Windows EPERM */ }
|
||||
}
|
||||
tmpDirs.length = 0;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ test("loadDefinition: valid 3-step YAML returns correct structure", () => {
|
|||
assert.deepEqual(def.steps[2].requires, ["outline"]);
|
||||
assert.deepEqual(def.steps[2].produces, ["draft.md"]);
|
||||
} finally {
|
||||
rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
||||
try { rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } catch { /* Windows EPERM */ }
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -235,7 +235,7 @@ test("loadDefinition: missing file → descriptive error", () => {
|
|||
},
|
||||
);
|
||||
} finally {
|
||||
rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
||||
try { rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } catch { /* Windows EPERM */ }
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -258,7 +258,7 @@ steps:
|
|||
},
|
||||
);
|
||||
} finally {
|
||||
rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
||||
try { rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } catch { /* Windows EPERM */ }
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -281,7 +281,7 @@ steps:
|
|||
const def = loadDefinition(dir, "test-workflow");
|
||||
assert.deepEqual(def.steps[1].requires, ["first"]);
|
||||
} finally {
|
||||
rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
||||
try { rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } catch { /* Windows EPERM */ }
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -302,7 +302,7 @@ steps:
|
|||
const def = loadDefinition(dir, "test-workflow");
|
||||
assert.deepEqual(def.steps[1].contextFrom, ["first"]);
|
||||
} finally {
|
||||
rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
||||
try { rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } catch { /* Windows EPERM */ }
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -738,7 +738,7 @@ steps:
|
|||
const def = loadDefinition(dir, "test-workflow");
|
||||
assert.equal(def.params, undefined);
|
||||
} finally {
|
||||
rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
||||
try { rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } catch { /* Windows EPERM */ }
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -755,7 +755,7 @@ steps:
|
|||
const def = loadDefinition(dir, "test-workflow");
|
||||
assert.equal(def.description, undefined);
|
||||
} finally {
|
||||
rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
||||
try { rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } catch { /* Windows EPERM */ }
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -773,6 +773,6 @@ steps:
|
|||
assert.deepEqual(def.steps[0].requires, []);
|
||||
assert.deepEqual(def.steps[0].produces, []);
|
||||
} finally {
|
||||
rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
||||
try { rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } catch { /* Windows EPERM */ }
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ function makeTmpDir(): string {
|
|||
|
||||
afterEach(() => {
|
||||
for (const d of tmpDirs) {
|
||||
rmSync(d, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
||||
try { rmSync(d, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } catch { /* Windows EPERM */ }
|
||||
}
|
||||
tmpDirs.length = 0;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ function makeTmpDir(): string {
|
|||
}
|
||||
|
||||
function cleanupDir(dir: string): void {
|
||||
rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
||||
try { rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } catch { /* Windows EPERM */ }
|
||||
}
|
||||
|
||||
/** Minimal valid graph for testing. */
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ function makeTmpDir(): string {
|
|||
|
||||
afterEach(() => {
|
||||
for (const d of tmpDirs) {
|
||||
rmSync(d, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
||||
try { rmSync(d, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } catch { /* Windows EPERM */ }
|
||||
}
|
||||
tmpDirs.length = 0;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ function makeTmpBase(): string {
|
|||
|
||||
afterEach(() => {
|
||||
for (const d of tmpDirs) {
|
||||
rmSync(d, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
||||
try { rmSync(d, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } catch { /* Windows EPERM */ }
|
||||
}
|
||||
tmpDirs.length = 0;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue