Shipflash logoDocs

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

LayerUse it for
Unit and feature testsValidation, services, persistence, provider adapters, config, retry rules, and module-specific regressions.
API testsRoute handlers, auth failures, invalid input, webhooks, and request/response envelopes.
Contract testsFile size, directories, naming, no barrels, no explicit any, migrations, and generated type drift.
E2E testsScenario-based browser journeys. E2E smoke tests are executed automatically in the CI pipeline on pushes and pull requests.
CI quality gatesRun quality for normal changes and quality:full for broad or release-sensitive work.

Testing source map

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.ts
  • src/features/notifications/server/outbox/services/__tests__/worker.test.ts
  • src/features/settings/server/actions/__tests__/website-settings.test.ts
  • src/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.ts
  • src/lib/auth/guards/__tests__/api.test.ts
  • src/lib/security/webhooks/__tests__/request.test.ts
  • src/lib/security/rate-limit/__tests__/policy.test.ts

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.