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-v8is 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:
-
Update vitest.config.js to include proper coverage configuration:
test: { coverage: { provider: "v8", reporter: ["text", "json", "html", "cobertura"], reportsDirectory: "./coverage", } } -
Verify coverage generation works locally with:
npm run test:coverage -
Re-enable coverage in CI by updating
.gitlab-ci.yml:- Add
--coverageflag back to test script - Restore coverage artifacts configuration
- Add coverage regex for GitLab to parse coverage percentage
- Add
Acceptance Criteria
-
Vitest generates cobertura-coverage.xmlfile 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)