Testing
Use targeted Vitest slices for feature behavior, contract checks for repo policy, and Playwright for manual cross-module browser journeys.
On this page
Test layers
| Layer | Use it for |
|---|---|
| Unit and feature tests | Validation, services, persistence, provider adapters, config, retry rules, and module-specific regressions. |
| API tests | Route handlers, auth failures, invalid input, webhooks, and request/response envelopes. |
| Contract tests | File size, directories, naming, no barrels, no explicit any, migrations, and generated type drift. |
| E2E tests | Scenario-based browser journeys. E2E smoke tests are executed automatically in the CI pipeline on pushes and pull requests. |
| CI quality gates | Run quality for normal changes and quality:full for broad or release-sensitive work. |
Implementation reference2 areas
These Product code locations explain how the documented behavior is implemented. Expand them when you are ready to customize or maintain this area.
Feature test examples
Use nearby tests to protect billing config, notification outbox, settings actions, and Supabase server behavior.
src/features/billing/server/catalog/__tests__/configuration.test.tssrc/features/notifications/server/outbox/services/__tests__/worker.test.tssrc/features/settings/server/actions/__tests__/website-settings.test.tssrc/lib/supabase/__tests__/server.test.ts
High-risk boundary tests
Auth guards, API route auth, webhook request guards, and rate-limit policy tests cover fail-closed behavior.
src/lib/auth/guards/__tests__/route.test.tssrc/lib/auth/guards/__tests__/api.test.tssrc/lib/security/webhooks/__tests__/request.test.tssrc/lib/security/rate-limit/__tests__/policy.test.ts
Reference paths are relative to the delivered product checkout.
Writing new tests
- Put tests near the behavior they protect.
- Cover invalid input, auth failures, retries, duplicate delivery, partial updates, and schema drift when relevant.
- Do not duplicate cheap Vitest coverage in Playwright.
- Run the targeted slice before pnpm run quality.