Problem
The CI runs npm run test:run but does not collect or report code coverage. There is no visibility into how well the codebase is tested, and no mechanism to prevent coverage regression. The @vitest/coverage-v8 package is already installed but unused in CI.
Scope of Work
1. Switch CI test command to use coverage
In .github/workflows/ci.yml, change npm run test:run to npm run test:coverage.
2. Add coverage thresholds in vitest config
In vitest.config.ts (or the vitest section of astro.config.mjs), add coverage thresholds. Start conservatively and ratchet up over time:
coverage: {
provider: 'v8',
thresholds: {
lines: 10,
branches: 10,
functions: 10,
statements: 10,
},
}
3. Upload coverage artifact
Add a step to upload the coverage report as a build artifact so it can be reviewed.
4. (Optional) PR coverage comment
Consider adding a step (e.g., via davelosert/vitest-coverage-report-action) to post a coverage summary as a PR comment.
Acceptance Criteria
Problem
The CI runs
npm run test:runbut does not collect or report code coverage. There is no visibility into how well the codebase is tested, and no mechanism to prevent coverage regression. The@vitest/coverage-v8package is already installed but unused in CI.Scope of Work
1. Switch CI test command to use coverage
In
.github/workflows/ci.yml, changenpm run test:runtonpm run test:coverage.2. Add coverage thresholds in vitest config
In
vitest.config.ts(or the vitest section ofastro.config.mjs), add coverage thresholds. Start conservatively and ratchet up over time:3. Upload coverage artifact
Add a step to upload the coverage report as a build artifact so it can be reviewed.
4. (Optional) PR coverage comment
Consider adding a step (e.g., via
davelosert/vitest-coverage-report-action) to post a coverage summary as a PR comment.Acceptance Criteria
test:coverageinstead oftest:run