Skip to content

[P1] feat: E2E test harness + mock client #108

Description

@four-bytes-robby

Purpose

Create reusable test fixtures and mock opencode plugin context for all E2E tests.

Technical Details

  • mock-plugin-context.ts: Minimal ctx implementation matching @opencode-ai/plugin types
    • ctx.client.session.summarize() — mockable, tracks calls
    • ctx.client.session.id — returns test session ID
    • No real filesystem/network access
  • sample-layers.ts: Pre-configured layer instances for testing
    • MockLayer (configurable content, order, enabled)
    • FailingLayer (throws on generate)
  • sample-messages.ts: Message history fixtures
    • Assistant message with compaction_signal block
    • User message with providerID/modelID in info
    • Empty assistant message (for placeholder injection test)
  • sample-signals.ts: Compaction signal fixtures
    • compact_now, compact_soon, no_compact variants

Files to Create

  • test/fixtures/mock-plugin-context.ts
  • test/fixtures/sample-layers.ts
  • test/fixtures/sample-messages.ts
  • test/fixtures/sample-signals.ts

Acceptance Criteria

  • All fixtures are TypeScript with proper types
  • Fixtures are importable by E2E test files
  • No external dependencies required

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions