diff --git a/src/app/api/chat/route.test.ts b/src/app/api/chat/route.test.ts index 061db1e..5d523c4 100644 --- a/src/app/api/chat/route.test.ts +++ b/src/app/api/chat/route.test.ts @@ -1,6 +1,10 @@ import { describe, expect, it, vi } from "vitest"; import type { ChatProvider, RunTurnArgs } from "@/lib/chat"; import type { ChartSpec } from "@/lib/reports/chart-spec"; +// Static import (vi.mock is hoisted above it): loading the route pulls in +// the provider SDKs, which is slow under a parallel run and must count +// as collection, not test time. +import { POST } from "./route"; const spec: ChartSpec = { id: "site-weekly", @@ -44,7 +48,6 @@ vi.mock("@/lib/chat", async (importOriginal) => { describe("POST /api/chat", () => { it("streams chart specs to the browser and only ids/titles to the model", async () => { - const { POST } = await import("./route"); const res = await POST( new Request("http://test/api/chat", { method: "POST",