-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Add reusable test fixtures for E2E testing with real AI SDK pipeline #20206
Description
Problem
Several tests need to exercise the real AI SDK streamText pipeline (not TestLLM mocks) against a fake HTTP server. Currently, llm.test.ts has its own inline fake server and SSE helpers, and any new test that needs the same infrastructure has to duplicate ~200 lines of boilerplate.
There is also no shared layer stack for tests that need the full SessionPrompt pipeline (tool registration via ToolRegistry, resolveTools, processor event handling) with a real LLM layer.
Proposal
Add two reusable test fixtures:
-
test/fixture/anthropic.ts— Fake Anthropic HTTP server (Bun.serve({port:0})) with lifecycle management (start/stop/reset) and SSE response helpers (toolResponse,textResponse,sse,waitRequest,deferred). -
test/fixture/prompt-layers.ts— FullSessionPromptEffect layer stack with realLLM.defaultLayerand no-op stubs for MCP/LSP/FileTime. Exports a singleenvlayer thattestEffect(env)can consume.
These fixtures unblock E2E tests for tool execution, metadata propagation, permission handling, and any other scenario that needs the complete prompt pipeline without mocking the LLM.
Context
Needed for the regression test in #20184 and reusable for future E2E tests.