Fix missing Cobertura coverage reports in CI pipeline

Problem

The CI pipeline's test:unit job is currently failing because it's configured to upload Cobertura coverage reports that are not being generated properly.

Current Issues:

  • Job fails with: WARNING: coverage/cobertura-coverage.xml: no matching files
  • Vitest with @vitest/coverage-v8 is not configured to generate Cobertura format reports
  • Coverage artifacts upload fails, causing the entire job to fail

Current Workaround

Coverage reporting has been temporarily disabled in the CI configuration to prevent job failures.

Solution

Configure Vitest to properly generate Cobertura coverage reports:

  1. Update vitest.config.js to include proper coverage configuration:

    test: {
      coverage: {
        provider: "v8",
        reporter: ["text", "json", "html", "cobertura"],
        reportsDirectory: "./coverage",
      }
    }
  2. Verify coverage generation works locally with:

    npm run test:coverage
  3. Re-enable coverage in CI by updating .gitlab-ci.yml:

    • Add --coverage flag back to test script
    • Restore coverage artifacts configuration
    • Add coverage regex for GitLab to parse coverage percentage

Acceptance Criteria

  • Vitest generates cobertura-coverage.xml file when running with --coverage
  • CI job successfully uploads coverage artifacts
  • GitLab displays coverage percentage in merge requests
  • Coverage reports are accessible in job artifacts
  • Job passes without coverage-related errors

Technical Details

Files to modify:

  • vitest.config.js - Add coverage configuration
  • .gitlab-ci.yml - Re-enable coverage artifacts

Dependencies:

  • @vitest/coverage-v8 (already installed)

References