Establish the foundational infrastructure that all live tests depend on: a dedicated vitest configuration for live tests, an npm script to invoke it, and a shared helper module with collection and assertion utilities. No actual live tests are written in this phase — this is the scaffolding.
Requirements
- Add
vitest.config.live.ts targeting src/__tests__/live/**/*.live.test.ts with 120s per-test timeout, maxConcurrency: 1, and pool: 'forks'
- The existing
vitest.config.ts include pattern (src/**/*.test.ts) must continue to exclude all *.live.test.ts files — confirm mutual exclusivity
- Add
"test:live": "vitest run --config vitest.config.live.ts" to package.json scripts
- Create
src/__tests__/live/ directory (empty, ready for test files)
- Create
src/__tests__/helpers/live-helpers.ts exporting:
collectLive(backend, options): Promise<ClaudeEvent[]> — drains the async generator from CliProcess.run()
assertEventStreamStructure(events: ClaudeEvent[]): void — asserts presence of ReadyEvent/TextEvent/DoneEvent, zero error events, seq monotonicity, ReadyEvent/DoneEvent sessionId match
- A credential-gating helper that returns
{ claudeAvailable, hasCredentials } for use in describe.skipIf calls
npm run test:live with no test files present must exit with code 0 (no tests found is not a failure)
npm test must not pick up any files from src/__tests__/live/
Design Guidance
Implements the 'Dual-Track Test Architecture' (ADR-001) and 'Live Test Helper Module' sections of the architecture design. The vitest config values (120s timeout, maxConcurrency: 1, retry: 0) are specified in the architecture. The assertEventStreamStructure function body is fully specified in the architecture's Component Design section.
Acceptance Criteria
Establish the foundational infrastructure that all live tests depend on: a dedicated vitest configuration for live tests, an npm script to invoke it, and a shared helper module with collection and assertion utilities. No actual live tests are written in this phase — this is the scaffolding.
Requirements
vitest.config.live.tstargetingsrc/__tests__/live/**/*.live.test.tswith 120s per-test timeout,maxConcurrency: 1, andpool: 'forks'vitest.config.tsinclude pattern (src/**/*.test.ts) must continue to exclude all*.live.test.tsfiles — confirm mutual exclusivity"test:live": "vitest run --config vitest.config.live.ts"topackage.jsonscriptssrc/__tests__/live/directory (empty, ready for test files)src/__tests__/helpers/live-helpers.tsexporting:collectLive(backend, options): Promise<ClaudeEvent[]>— drains the async generator fromCliProcess.run()assertEventStreamStructure(events: ClaudeEvent[]): void— asserts presence of ReadyEvent/TextEvent/DoneEvent, zero error events, seq monotonicity, ReadyEvent/DoneEvent sessionId match{ claudeAvailable, hasCredentials }for use indescribe.skipIfcallsnpm run test:livewith no test files present must exit with code 0 (no tests found is not a failure)npm testmust not pick up any files fromsrc/__tests__/live/Design Guidance
Implements the 'Dual-Track Test Architecture' (ADR-001) and 'Live Test Helper Module' sections of the architecture design. The vitest config values (120s timeout, maxConcurrency: 1, retry: 0) are specified in the architecture. The
assertEventStreamStructurefunction body is fully specified in the architecture's Component Design section.Acceptance Criteria
npm run test:liveexits 0 with output indicating no test files foundnpm testoutput confirms zero files fromsrc/__tests__/live/were executedsrc/__tests__/helpers/live-helpers.tscompiles undertsconfig.test.jsonwith no type errorscollectLive()andassertEventStreamStructure()are exported and importable from live test filespackage.jsoncontainstest:livescript pointing tovitest.config.live.ts