Merge PR #3354: fix: migrate coding-agent tests to removeWithRetries (@oldschoola)
This commit is contained in:
@@ -13,7 +13,7 @@ import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings";
|
||||
import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session";
|
||||
import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage";
|
||||
import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager";
|
||||
import { Snowflake } from "@oh-my-pi/pi-utils";
|
||||
import { removeSyncWithRetries, Snowflake } from "@oh-my-pi/pi-utils";
|
||||
|
||||
function makeEvent(): AgentEvent {
|
||||
return { type: "tool_execution_start", toolCallId: "probe-1", toolName: "probe", args: {} };
|
||||
@@ -95,7 +95,7 @@ describe("#emit listener isolation", () => {
|
||||
authStorage = undefined;
|
||||
if (fs.existsSync(tempDir)) {
|
||||
try {
|
||||
fs.rmSync(tempDir, { recursive: true, force: true });
|
||||
removeSyncWithRetries(tempDir);
|
||||
} catch {
|
||||
// Windows may hold sqlite handles briefly after close; best-effort cleanup.
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as path from "node:path";
|
||||
import { CURRENT_SESSION_VERSION, type SessionHeader } from "@oh-my-pi/pi-coding-agent/session/session-entries";
|
||||
import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager";
|
||||
import { getTerminalId } from "@oh-my-pi/pi-tui";
|
||||
import { getAgentDir, getTerminalSessionsDir, setAgentDir, TempDir } from "@oh-my-pi/pi-utils";
|
||||
import { getAgentDir, getTerminalSessionsDir, removeWithRetries, setAgentDir, TempDir } from "@oh-my-pi/pi-utils";
|
||||
|
||||
interface JsonlMessageEntry {
|
||||
type: "message";
|
||||
@@ -51,7 +51,7 @@ describe("SessionManager.forkFrom", () => {
|
||||
const terminalId = getTerminalId();
|
||||
expect(terminalId).toBeString();
|
||||
const breadcrumbFile = path.join(getTerminalSessionsDir(), terminalId ?? "missing");
|
||||
await fs.rm(breadcrumbFile, { force: true });
|
||||
await removeWithRetries(breadcrumbFile);
|
||||
|
||||
const forked = await SessionManager.forkFrom(sourceFile, cwd, sessionDir, undefined, {
|
||||
suppressBreadcrumb: true,
|
||||
|
||||
Reference in New Issue
Block a user