fix(test): migrate fs.rmSync to removeSyncWithRetries in 5 more test files

Batch migration of 13 fs.rmSync calls to removeSyncWithRetries across:
- core/apply-patch.test.ts (4 calls)
- bash-executor.test.ts (4 calls)
- tools.test.ts (2 calls)
- compaction-hooks.test.ts (1 call)
- compaction-thinking-model.test.ts (2 calls)

Also exports removeSyncWithRetries from @oh-my-pi/pi-utils as a
standalone function for tests that manage their own temp dirs.

All tests pass: 139 pass, 0 fail across the 5 migrated files.
This commit is contained in:
oldschoola
2026-06-19 17:30:58 -07:00
parent 1a92b3f854
commit a436dfbbeb
7 changed files with 23 additions and 17 deletions
@@ -12,7 +12,7 @@ import { afterEach, beforeEach, describe } from "bun:test";
import * as fs from "node:fs";
import * as os from "node:os";
import * as path from "node:path";
import { Snowflake } from "@oh-my-pi/pi-utils";
import { removeSyncWithRetries, Snowflake } from "@oh-my-pi/pi-utils";
import { e2eApiKey } from "./utilities";
// Check for auth
@@ -36,7 +36,7 @@ describe.skipIf(!HAS_ANTIGRAVITY_AUTH)("Compaction with thinking models (Antigra
authStorage?.close();
authStorage = undefined;
if (tempDir && fs.existsSync(tempDir)) {
fs.rmSync(tempDir, { recursive: true });
removeSyncWithRetries(tempDir);
}
});
});
@@ -61,7 +61,7 @@ describe.skipIf(!HAS_ANTHROPIC_AUTH)("Compaction with thinking models (Anthropic
authStorage?.close();
authStorage = undefined;
if (tempDir && fs.existsSync(tempDir)) {
fs.rmSync(tempDir, { recursive: true });
removeSyncWithRetries(tempDir);
}
});
});