diff options
| author | Kit Langton <[email protected]> | 2026-04-01 22:22:43 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-01 22:22:43 -0400 |
| commit | a09b086729063be9b882bc174cb8eb16d6ecec9b (patch) | |
| tree | 9b1c3a624f5d9a8b9fc89237034c741969d2cf1f /packages/app/test | |
| parent | df1c6c9e8da61859329ace94dd53939bd1df1781 (diff) | |
| download | opencode-a09b086729063be9b882bc174cb8eb16d6ecec9b.tar.gz opencode-a09b086729063be9b882bc174cb8eb16d6ecec9b.zip | |
test(app): block real llm calls in e2e prompts (#20579)
Diffstat (limited to 'packages/app/test')
| -rw-r--r-- | packages/app/test/e2e/no-real-llm.test.ts | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/app/test/e2e/no-real-llm.test.ts b/packages/app/test/e2e/no-real-llm.test.ts new file mode 100644 index 000000000..c801df56f --- /dev/null +++ b/packages/app/test/e2e/no-real-llm.test.ts @@ -0,0 +1,27 @@ +import { describe, expect, test } from "bun:test" +import path from "node:path" +import { fileURLToPath } from "node:url" + +const dir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../e2e") + +function hasPrompt(src: string) { + if (!src.includes("withProject(")) return false + if (src.includes("withNoReplyPrompt(")) return false + if (src.includes("session.promptAsync({") && !src.includes("noReply: true")) return true + if (!src.includes("promptSelector")) return false + return src.includes('keyboard.press("Enter")') || src.includes('prompt.press("Enter")') +} + +describe("e2e llm guard", () => { + test("withProject specs do not submit prompt replies", async () => { + const bad: string[] = [] + + for await (const file of new Bun.Glob("**/*.spec.ts").scan({ cwd: dir, absolute: true })) { + const src = await Bun.file(file).text() + if (!hasPrompt(src)) continue + bad.push(path.relative(dir, file)) + } + + expect(bad).toEqual([]) + }) +}) |
