Skip to content

test: add reusable fixtures for E2E testing with real AI SDK pipeline#20208

Open
rmk40 wants to merge 1 commit intoanomalyco:devfrom
rmk40:test/e2e-fixtures
Open

test: add reusable fixtures for E2E testing with real AI SDK pipeline#20208
rmk40 wants to merge 1 commit intoanomalyco:devfrom
rmk40:test/e2e-fixtures

Conversation

@rmk40
Copy link
Copy Markdown
Contributor

@rmk40 rmk40 commented Mar 31, 2026

Issue for this PR

Closes #20206

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds two shared test fixtures that enable E2E tests through the real AI SDK streamText pipeline without mocking the LLM layer:

  • test/fixture/anthropic.ts — Fake Anthropic HTTP server (Bun.serve({port:0})) with lifecycle management (start/stop/reset/origin) and SSE response helpers (toolResponse, textResponse, sse, waitRequest, deferred). The server queues responses FIFO and captures request details for assertions.

  • test/fixture/prompt-layers.ts — Full SessionPrompt Effect layer stack with real LLM.defaultLayer and no-op stubs for MCP/LSP/FileTime. Exports a single env layer that testEffect(env) can consume directly.

Currently, llm.test.ts has its own inline fake server and SSE helpers (~80 lines). These fixtures extract and generalize that pattern so future tests that need the complete prompt pipeline (tool registration via ToolRegistry, resolveTools, processor event handling) can import them instead of duplicating boilerplate.

First consumer will be the regression test for #20184.

How did you verify your code works?

  • bun typecheck passes from packages/opencode
  • Full turbo typecheck passes across all 13 packages
  • No tests to run yet — these are fixtures, not test files. First consumer is in a follow-up PR.

Screenshots / recordings

N/A — test infrastructure, not UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Add two shared test fixtures that enable E2E tests through the real
AI SDK streamText pipeline without mocking:

- test/fixture/anthropic.ts: fake Anthropic HTTP server with SSE
  response helpers (toolResponse, textResponse, waitRequest, deferred)
- test/fixture/prompt-layers.ts: full SessionPrompt Effect layer stack
  with real LLM.defaultLayer and no-op stubs for MCP/LSP/FileTime

These fixtures reduce boilerplate for tests that need to exercise the
complete prompt pipeline (tool registration, resolveTools, processor
event handling) against a fake provider.

Closes anomalyco#20206
@rmk40 rmk40 force-pushed the test/e2e-fixtures branch from 317dc09 to 6d82489 Compare March 31, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add reusable test fixtures for E2E testing with real AI SDK pipeline

1 participant