Skip to content

[Critical] Add test coverage metrics and CI gates #56

@jessfortemnaturae8717

Description

@jessfortemnaturae8717

Problem

No test coverage metrics despite having 689 tests. Can't verify quality or catch coverage regressions.

Current state:

  • @vitest/coverage-v8 installed as devDependency
  • No coverage configuration in vitest.config.ts
  • No coverage reports generated
  • No CI gates for coverage thresholds

Risk

  • New code may lack tests
  • Coverage could regress without notice
  • Can't demonstrate quality to enterprise customers

Solution

Enable coverage reporting with minimum thresholds.

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

Tasks

  • Configure vitest coverage in vitest.config.ts
  • Add npm run test:coverage script
  • Generate baseline coverage report
  • Add coverage badge to README
  • Add CI job to check coverage thresholds
  • Fail PR if coverage drops below threshold
  • Upload coverage to Codecov/Coveralls

Proposed Thresholds

Metric Minimum Target
Statements 80% 90%
Branches 75% 85%
Functions 80% 90%
Lines 80% 90%

Acceptance Criteria

  • npm run test:coverage generates HTML report
  • CI fails if coverage below thresholds
  • Coverage badge visible in README
  • Coverage trend visible in PR comments

Priority: P1 — Required for enterprise credibility

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions