Skip to content

Testing

Test commands

expressiveCode.terminalWindowFallbackTitle
# Run all tests across the monorepo
pnpm test
# Run tests for a specific package
pnpm --filter @jarvis/api-gateway test
# Typecheck all packages
pnpm typecheck

Test policy

Every bug fix requires a regression test. Every new API endpoint requires at least one test. pnpm test must pass before any commit.

Test placement

  • Unit tests: co-located with source (foo.tsfoo.test.ts)
  • Integration tests: packages/<name>/src/__tests__/
  • All test files: .test.ts extension

What we test

LayerTest typeKey files
Archetype configsUnitpackages/core/src/archetypes/configs.test.ts
FormattersUnitpackages/core/src/formatters.test.ts
Assessment engineUnit + integrationpackages/api-gateway/src/lib/assessment.test.ts
Policy evaluatorUnitpackages/api-gateway/src/lib/policy-evaluator.test.ts
API routesIntegrationpackages/api-gateway/src/__tests__/

Running specific test suites

expressiveCode.terminalWindowFallbackTitle
# Run only api-gateway tests
cd packages/api-gateway && pnpm test
# Run with watch mode (development)
cd packages/api-gateway && pnpm test --watch
# Run with coverage
cd packages/api-gateway && pnpm test --coverage

Test data

Test fixtures live in packages/api-gateway/src/__tests__/fixtures/. Do not use production API keys in tests. The test environment uses a dedicated Supabase project.