Skip to main content

ADR-0051: 80% Test Coverage Requirement

Status

Accepted - 2025-01-26


Context

Code coverage ensures critical paths are tested and prevents regressions.


Decision

80% minimum coverage with Vitest.

Rationale

  1. Practical: Balances thoroughness and development speed
  2. Critical Paths: 100% for auth, payments, RLS
  3. Industry Standard: Most teams use 70-80%

Configuration

// vitest.config.ts
export default defineConfig({
test: {
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
lines: 80,
functions: 80,
branches: 80,
statements: 80,
},
},
});

Critical Paths (100% Required)

  • Authentication & authorization
  • Payment processing
  • RLS policies
  • Booking logic (prevent double-booking)

CI/CD Integration

# Fail build if coverage <80%
pnpm test:coverage

References