From aeba1d6b47e4602d8e3159f1b0abfe6022c47b72 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 27 Apr 2026 17:34:05 +0100 Subject: [PATCH] test: keep stateful tests out of unit-fast --- src/proxy-capture/runtime.test.ts | 4 +++- test/vitest-unit-fast-config.test.ts | 4 +++- test/vitest/vitest.unit-fast-paths.mjs | 3 --- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/proxy-capture/runtime.test.ts b/src/proxy-capture/runtime.test.ts index 50cad7bc2cc..40f81d30782 100644 --- a/src/proxy-capture/runtime.test.ts +++ b/src/proxy-capture/runtime.test.ts @@ -59,6 +59,7 @@ describe("debug proxy runtime", () => { }); afterEach(() => { + finalizeDebugProxyCapture(); globalThis.fetch = originalFetch; for (const key of envKeys) { const value = savedEnv[key]; @@ -71,7 +72,7 @@ describe("debug proxy runtime", () => { }); it("captures ambient global fetch calls when debug proxy mode is enabled", async () => { - globalThis.fetch = vi.fn(async () => ({ status: 200 }) as Response) as typeof fetch; + globalThis.fetch = vi.fn(async () => new Response("{}", { status: 200 })) as typeof fetch; initializeDebugProxyCapture("test"); await globalThis.fetch("https://api.minimax.io/anthropic/messages", { @@ -79,6 +80,7 @@ describe("debug proxy runtime", () => { headers: { "content-type": "application/json" }, body: '{"input":"hello"}', }); + await new Promise((resolve) => setImmediate(resolve)); finalizeDebugProxyCapture(); const events = storeState.events.filter((event) => event.sessionId === "runtime-test-session"); diff --git a/test/vitest-unit-fast-config.test.ts b/test/vitest-unit-fast-config.test.ts index 11715fc9dcc..c6d07202ac7 100644 --- a/test/vitest-unit-fast-config.test.ts +++ b/test/vitest-unit-fast-config.test.ts @@ -43,7 +43,9 @@ describe("unit-fast vitest lane", () => { it("keeps obvious stateful files out of the unit-fast lane", () => { expect(isUnitFastTestFile("src/plugin-sdk/temp-path.test.ts")).toBe(false); expect(isUnitFastTestFile("src/agents/sandbox.resolveSandboxContext.test.ts")).toBe(false); - expect(isUnitFastTestFile("src/tts/tts-config.test.ts")).toBe(false); + expect(isUnitFastTestFile("src/crestodian/overview.test.ts")).toBe(false); + expect(isUnitFastTestFile("src/proxy-capture/runtime.test.ts")).toBe(false); + expect(isUnitFastTestFile("src/security/windows-acl.test.ts")).toBe(false); expect(resolveUnitFastTestIncludePattern("src/plugin-sdk/temp-path.ts")).toBeNull(); expect(classifyUnitFastTestFileContent("vi.resetModules(); await import('./x.js')")).toEqual([ "module-mocking", diff --git a/test/vitest/vitest.unit-fast-paths.mjs b/test/vitest/vitest.unit-fast-paths.mjs index ecd4951b34f..6a62ceee824 100644 --- a/test/vitest/vitest.unit-fast-paths.mjs +++ b/test/vitest/vitest.unit-fast-paths.mjs @@ -68,7 +68,6 @@ export const forcedUnitFastTestFiles = [ "src/acp/server.startup.test.ts", "src/acp/translator.session-rate-limit.test.ts", "src/browser-lifecycle-cleanup.test.ts", - "src/crestodian/overview.test.ts", "src/crestodian/crestodian.test.ts", "src/crestodian/operations.test.ts", "src/crestodian/rescue-message.test.ts", @@ -96,7 +95,6 @@ export const forcedUnitFastTestFiles = [ "src/pairing/allow-from-store-read.test.ts", "src/pairing/pairing-store.test.ts", "src/plugin-sdk/memory-host-events.test.ts", - "src/proxy-capture/runtime.test.ts", "src/proxy-capture/store.sqlite.test.ts", "src/security/audit-exec-surface.test.ts", "src/security/audit-extra.async.test.ts", @@ -106,7 +104,6 @@ export const forcedUnitFastTestFiles = [ "src/security/external-content.test.ts", "src/security/fix.test.ts", "src/security/skill-scanner.test.ts", - "src/security/windows-acl.test.ts", "src/realtime-transcription/websocket-session.test.ts", "src/routing/resolve-route.test.ts", "src/trajectory/export.test.ts",