Bay uses Vitest for unit, integration, and workflow tests. Suites must stay offline — no OpenRouter, Ollama, or cloud speech.
pnpm test # full suite
pnpm test:smoke # fast critical subset
pnpm test:watch # interactive
pnpm typecheck # tsc --noEmit
pnpm run quality # typecheck + full tests (quality gate)GitHub Actions runs pnpm run quality on push/PR to main (see .github/workflows/ci.yml).
Note: use pnpm run quality — bare pnpm ci is pnpm’s clean-install command, not this script.
| Path | Role |
|---|---|
tests/*.test.ts |
Specs (phase-tagged where useful) |
tests/helpers/harness.ts |
Temp data root + MockLLM agent |
tests/helpers/fixtures.ts |
Sample vehicles, service history, taste signals |
src/testing/mock-llm.ts |
Deterministic MockLLMProvider |
src/obd/mock.ts |
Mock OBD / vehicle data provider |
- Temp dirs — each harness uses
mkdtempunder the OS temp folder; never write to~/.bayin tests. - Mock LLM — inject
MockLLMProviderintoAgent/TasteManager. Script text, tool calls, or plan JSON. - Mock OBD — use
ObdManager.connect("mock", { scenario })orMockVehicleDataProviderdirectly. - High-value coverage — taste, plans, diagnostics, OBD, watchdogs, reports, exports, doctor, garage mode. Not 100% line coverage.
- Avoid brittle snapshots — assert structure, safety language, and key codes/paths.
import { createTestHarness, useTempCleanup } from "./helpers/harness.js";
useTempCleanup();
const h = createTestHarness({ withTacoma: true });
h.llm.enqueueToolCall("calculate", { expression: "2+2" });
h.llm.enqueueText("Result is 4. Suggestion only.");
const result = await h.agent.answer("What is 2+2?");- Smoke — version, aliases, safety, MockLLM/OBD connect, harness boot.
- Full — includes multi-step diagnosis, watchdogs, ownership reports, doctor integrity, Phase 1–12 regressions.
Prefer extending createTestHarness() over copying temp-dir boilerplate. Put reusable doubles in src/testing/. Name new files tests/<area>.test.ts or tests/phaseN-*.test.ts.