fix: migrate coding-agent tests from fs.rm to removeWithRetries
Migrate 203 test files (356 call sites) from fs.rm/fs.rmSync to
removeWithRetries/removeSyncWithRetries to reduce EBUSY test failures
on Windows. removeWithRetries is now exported from @oh-my-pi/pi-utils.
The migration uses a regex-based approach that:
- Replaces fs.rm(path, { recursive, force }) → removeWithRetries(path)
- Replaces fs.rmSync(path, { recursive, force }) → removeSyncWithRetries(path)
- Replaces fs.rm(path) → removeWithRetries(path) (no options)
- Skips fs.rm/fs.rmSync inside template literals (bun --eval scripts)
- Adds imports to existing @oh-my-pi/pi-utils import or creates new one
- Removes unused fs imports where fs.rm was the only fs usage (4 files)
This commit is contained in:
@@ -2,6 +2,7 @@ import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import * as fs from "node:fs/promises";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import { removeWithRetries } from "@oh-my-pi/pi-utils";
|
||||
import { $ } from "bun";
|
||||
import * as git from "../src/utils/git";
|
||||
|
||||
@@ -55,9 +56,9 @@ describe.skipIf(!supportsReftable)("git reftable support", () => {
|
||||
|
||||
afterAll(async () => {
|
||||
await $`git worktree remove ${worktreeDir} -f`.cwd(sharedRepoDir).quiet().nothrow();
|
||||
await fs.rm(worktreeDir, { recursive: true, force: true }).catch(() => {});
|
||||
await fs.rm(sharedRepoDir, { recursive: true, force: true }).catch(() => {});
|
||||
await fs.rm(configRepoDir, { recursive: true, force: true }).catch(() => {});
|
||||
await removeWithRetries(worktreeDir).catch(() => {});
|
||||
await removeWithRetries(sharedRepoDir).catch(() => {});
|
||||
await removeWithRetries(configRepoDir).catch(() => {});
|
||||
});
|
||||
|
||||
test("resolves references in a reftable repository", async () => {
|
||||
|
||||
Reference in New Issue
Block a user