Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/prompt/file/ts/execution-inputs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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<ReturnType<FilePromptProvider["getAllPrompts"]>>;

function fileType() {
return new TSPromptFileType(new LocalFileProvider());
}
Expand Down Expand Up @@ -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();
Expand Down
Loading