From 412eb3bf5df2054dfded0ceb090f439dfc89a36b Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 23:43:12 +0000 Subject: [PATCH] =?UTF-8?q?Build=20the=20=C2=A7D=20test=20project=20once,?= =?UTF-8?q?=20outside=20the=205s=20test=20timeout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The first test in "resource-to-slot matching" built a cold ts.Program inside the test body: about 4.5s on its own, and it overran vitest's 5s default on a loaded CI runner (main, Node 22.18.0). The three tests that read that project now share one build in a beforeAll with a 30s timeout. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01Dd8yB5VfezQ3ymwdwAkixZ --- src/prompt/file/ts/execution-inputs.test.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/prompt/file/ts/execution-inputs.test.ts b/src/prompt/file/ts/execution-inputs.test.ts index 7e8258f..61ccbdd 100644 --- a/src/prompt/file/ts/execution-inputs.test.ts +++ b/src/prompt/file/ts/execution-inputs.test.ts @@ -4,7 +4,7 @@ import path from "node:path"; import { fileURLToPath, pathToFileURL } from "node:url"; import type { PropDefinition } from "ts-proppy"; -import { describe, expect, it, vi } from "vitest"; +import { beforeAll, describe, expect, it, vi } from "vitest"; import { LocalFileProvider } from "../../../file-provider-local.ts"; import { MemoryFileProvider } from "../../../file-provider-memory.ts"; import { VercelAISDK } from "../../../sdk/vercel-ai-sdk/index.ts"; @@ -16,6 +16,8 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url)); const fixturesDir = path.join(__dirname, "__fixtures__"); const fixture = (name: string) => path.join(fixturesDir, name); +type PromptList = Awaited>; + function fileType() { return new TSPromptFileType(new LocalFileProvider()); } @@ -63,15 +65,23 @@ describe("resource-to-slot matching (§D)", () => { * types both refer to. Real files because both halves have to land in one * `ts.Program` for the checker to relate them. */ + let prompts: PromptList; async function project() { + return prompts; + } + + // Built once, for tests that only read it. The first build in this file + // pays for a cold `ts.Program` (about 4.5s on its own, more on a loaded CI + // runner), which overran the default 5s timeout when it fell inside an `it`. + beforeAll(async () => { const provider = new FilePromptProvider({ rootDir: fixturesDir, includePatterns: ["opaque-param.prompt.ts"], playgroundIncludePatterns: ["odin.playground.ts"], sdk: new VercelAISDK(), }); - return provider.getAllPrompts(); - } + prompts = await provider.getAllPrompts(); + }, 30_000); it("offers a resource on every slot its type fits, and only those", async () => { const [prompt] = await project();