Skip to content

Testing Standards

github-actions[bot] edited this page Oct 13, 2026 · 3 revisions

Canonical source: testing/README.md — this page is rendered from it on every publish; edit the source.

ClawAI Testing Standards

The prescriptive testing standards for the ClawAI monorepo (21 NestJS services + Next.js frontend + 6 shared packages). These documents say what good testing is here; the why (post-mortem lessons) lives in ../memory/testing-strategy.md.

Runners

Layer Runner Notes
Backend unit/integration Vitest (swc) *.spec.ts co-located in __tests__/
Frontend unit/component Vitest *.test.ts / *.spec.ts
End-to-end (browser) Playwright user journeys through the real UI

Every workspace runs Vitest (vitest run); Playwright stays for E2E. Jest was removed from all workspaces on 2026-09-17 (ADR-099, superseding ADR-062).

Core principles

  1. Risk-based test design, not count quotas. Design tests from the risk surface of the unit. The old "20–25 API variations per endpoint" quota is an anti-pattern — it rewards padding and misses the one dangerous branch. See testing-strategy.
  2. Coverage proportional to blast radius. Global ≥95% statements/lines/functions, ≥90% branches; 100% branch on pure critical logic (schemas, mappers, permission/ ownership decisions, query-key builders, event validators). See coverage-policy.
  3. TDD by default. Write the failing test before the implementation.
  4. Defense in depth. Each layer catches a different bug class; green unit gates are necessary, not sufficient.
  5. Verify persistence and logs, not just responses. A 2xx is not proof.

Index

Related

Clone this wiki locally