diff --git a/packages/coding-agent/test/input-controller-escape.test.ts b/packages/coding-agent/test/input-controller-escape.test.ts index de86e4019..407a83341 100644 --- a/packages/coding-agent/test/input-controller-escape.test.ts +++ b/packages/coding-agent/test/input-controller-escape.test.ts @@ -2,8 +2,8 @@ import { describe, expect, it, type Mock, vi } from "bun:test"; import { InputController } from "@oh-my-pi/pi-coding-agent/modes/controllers/input-controller"; import type { InteractiveModeContext, SubmittedUserInput } from "@oh-my-pi/pi-coding-agent/modes/types"; - type Spy = Mock<(...args: unknown[]) => unknown>; +type StartPendingSubmissionSpy = Mock; type FakeEditor = { onEscape?: () => void; onSubmit?: (text: string) => Promise; @@ -64,7 +64,7 @@ function createContext(): { onInputCallback: Spy; prompt: Spy; requestRender: Spy; - startPendingSubmission: Spy; + startPendingSubmission: StartPendingSubmissionSpy; }; } { let editorText = ""; diff --git a/packages/coding-agent/test/interactive-mode-plan-review.test.ts b/packages/coding-agent/test/interactive-mode-plan-review.test.ts index 39e29929b..acb9f986f 100644 --- a/packages/coding-agent/test/interactive-mode-plan-review.test.ts +++ b/packages/coding-agent/test/interactive-mode-plan-review.test.ts @@ -39,6 +39,7 @@ describe("InteractiveMode plan review rendering", () => { }); beforeEach(async () => { + Bun.gc(true); resetSettingsForTest(); tempDir = TempDir.createSync("@pi-plan-review-"); await Settings.init({ inMemory: true, cwd: tempDir.path() }); @@ -67,11 +68,20 @@ describe("InteractiveMode plan review rendering", () => { afterEach(async () => { vi.restoreAllMocks(); - mode?.stop(); - await session?.dispose(); - authStorage?.close(); - tempDir?.removeSync(); + const currentMode = mode; + const currentSession = session; + const currentAuthStorage = authStorage; + const currentTempDir = tempDir; + mode = undefined as unknown as InteractiveMode; + session = undefined as unknown as AgentSession; + authStorage = undefined as unknown as AuthStorage; + tempDir = undefined as unknown as TempDir; + currentMode?.stop(); + await currentSession?.dispose(); + currentAuthStorage?.close(); + currentTempDir?.removeSync(); resetSettingsForTest(); + Bun.gc(true); }); it("appends each submitted plan review preview to preserve scrollback", async () => { diff --git a/packages/coding-agent/test/mcp-http-transport.test.ts b/packages/coding-agent/test/mcp-http-transport.test.ts index 7e40bb057..d828e8de9 100644 --- a/packages/coding-agent/test/mcp-http-transport.test.ts +++ b/packages/coding-agent/test/mcp-http-transport.test.ts @@ -57,7 +57,7 @@ describe("HTTP MCP transport", () => { connection = await connectToServer("storybook", { type: "http", url: String(activeServer.url), - timeout: 200, + timeout: 1_000, }); expect(connection.serverInfo.name).toBe("storybook-repro"); diff --git a/packages/coding-agent/test/tools.test.ts b/packages/coding-agent/test/tools.test.ts index ec85792b6..83a6bd1d6 100644 --- a/packages/coding-agent/test/tools.test.ts +++ b/packages/coding-agent/test/tools.test.ts @@ -1108,7 +1108,7 @@ function b() { const updates: string[] = []; const result = await bashTool.execute( "test-call-8-stream", - { command: "for i in 1 2 3; do echo $i; sleep 0.05; done" }, + { command: "for i in 1 2 3; do echo $i; sleep 0.2; done" }, undefined, update => { const text = update.content?.find(c => c.type === "text")?.text ?? "";