| name | testing-workflow |
| description | Use when adding or changing tests, or before considering a change done, in ChatbotX. Documents the real verification gate sequence (lint → types → test → coverage), where tests live, the Vitest setup, and the coverage threshold that must not be silently bypassed. Read before writing tests or claiming a task is verified. |
Testing Workflow (ChatbotX)
The verification gate every change passes before it is "done". CI currently does not run these (it builds Docker images only), so they are enforced locally — run them yourself, do not assume CI catches regressions.
The gate sequence (run in order, fix before advancing)
- Lint —
pnpm lint (Ultracite/Biome). Use pnpm fix to auto-fix, never hand-format.
- Types —
pnpm --filter <app|package> check-types for every workspace you touched.
- Test — run the affected package's Vitest suite.
- Coverage — keep the 80% threshold (
packages/vitest-config/src/node.ts). Do not set VITEST_SKIP_COVERAGE_THRESHOLDS to dodge it — that silently nulls all thresholds and hides under-coverage.
Where tests live
- App/package/integration-level tests (actions, routes, API behavior, cache, worker behavior, cross-boundary):
<workspace>/__tests__/ — e.g. apps/builder/__tests__, apps/worker/__tests__, packages/sdk/__tests__, integrations/messenger/__tests__.
- Narrow unit/component tests owned by one module: colocated
src/**/__tests__.
Test design (AAA + behavior names)
- Arrange–Act–Assert structure.
- Name by behavior: , not .