testing · git:20260329.8cf93fd · 2026-03-29 · sha256 2f657a75c504af80
testing git:20260329.8cf93fdA
Immutable. This exact content never changes and is served at /api/v1/blob/2f657a75c504af80.
--- description: Vitest testing patterns for Caliber globs: src/**/__tests__/** --- - Vitest config: `vitest.config.ts` · Setup: `src/test/setup.ts` - Run all: `npm run test` · Single: `npx vitest run src/scoring/__tests__/accuracy.test.ts` - Coverage: `npm run test:coverage` (v8 provider) - LLM calls globally mocked in `src/test/setup.ts` — never call real providers - Use `vi.mock()` for `fs`, `child_process` · `vi.mocked()` for type-safe assertions - Tests colocated: `src/llm/__tests__/config.test.ts` tests `src/llm/config.ts` - Pattern: `describe` → `beforeEach(vi.clearAllMocks)` → `it` with `expect` - Environment vars: save in `beforeEach`, restore in `afterEach`