Skip to content

Phase 5: Copilot live test suite #8

Description

@tinkermonkey

Create the live Copilot test file with five test cases that exercise CliProcess with backend: 'copilot' against the real Copilot CLI binary. Tests gate on binary availability and a dry-run authentication check. Copilot live tests are primarily for local validation — CI skips them gracefully when the binary is absent.

Requirements

  • Create src/__tests__/live/copilot.live.test.ts
  • beforeAll must: (1) check CliProcess('copilot').isAvailable(), (2) perform a minimal dry-run CliProcess('copilot').run() with a 30s timeout to verify authentication; if either check fails, skip the entire suite via describe.skipIf
  • Use collectLive() and assertEventStreamStructure() from Phase 1 helpers
  • Implement five test cases:
    1. Golden path: call assertEventStreamStructure() on collected events
    2. ReadyEvent session UUID: assert ReadyEvent.sessionId matches UUID format
    3. Text content emitted: assert at least one TextEvent with non-empty text
    4. Session resume: second run with sessionId from first run; assert ReadyEvent.sessionId matches
    5. AbortSignal mid-run: abort after ReadyEvent; assert final event is ErrorEvent { code: 'aborted' }
  • No test must fail solely because the copilot binary is absent from the runner

Design Guidance

Implements the 'Copilot Live Test Suite' section of the architecture design. The authentication gating via dry-run invocation, the five test cases, and the 'No per-token cost' rationale are documented in the architecture's component design for copilot.live.test.ts.

Acceptance Criteria

  • npm run test:live with no copilot binary in PATH shows Copilot live tests as skipped (not failed)
  • Suite skips when copilot is present but not authenticated
  • With a valid authenticated Copilot environment, all five tests pass
  • Golden path test satisfies assertEventStreamStructure() (ReadyEvent, TextEvent, DoneEvent; no errors; seq monotonic; sessionIds match)
  • AbortSignal test confirms final event is ErrorEvent { code: 'aborted' }
  • Code is reviewed and approved

Dependencies

Phase 1, Phase 4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions