feat: 初始提交
This commit is contained in:
13
tests/helpers.ts
Normal file
13
tests/helpers.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { rm } from "node:fs/promises";
|
||||
|
||||
export async function rmRetry(dir: string, retries = 10, delayMs = 500) {
|
||||
for (let i = 0; i < retries; i++) {
|
||||
try {
|
||||
await rm(dir, { force: true, recursive: true });
|
||||
return;
|
||||
} catch (e) {
|
||||
if (i === retries - 1) throw e;
|
||||
await new Promise((r) => setTimeout(r, delayMs));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user