Add Vitest coverage reporting so we can see how much of the codebase the tests exercise.
π§ Context
The project uses Vitest (pnpm test β vitest run). Coverage is not enabled. Vitest has built-in coverage (the equivalent of pytest-cov) via a provider package.
The goal here is reporting only β print a coverage summary and generate an HTML report. Do not add an enforced threshold that fails the build. The test suite is still small, so a hard gate would just block PRs; a threshold can be added later once coverage is meaningful.
π οΈ Implementation Plan
- Install the coverage provider:
pnpm add -D @vitest/coverage-v8 (the default V8 provider β fast, native). This repo has security settings in pnpm-workspace.yaml; if the install is blocked by a policy error, flag it to Jacc rather than working around it.
- Add a
test:coverage script to package.json: vitest run --coverage.
- Configure coverage in
vite.config.ts under test.coverage:
provider: 'v8'
reporter: ['text', 'html'] (terminal summary + an HTML report)
- sensible
excludes: src/main.tsx, **/*.test.ts, config files (*.config.*), type-only files (src/types/**), and the test setup.
- No thresholds.
- Run
pnpm test:coverage and confirm it prints a summary table and writes the HTML report.
- Add the coverage output directory (e.g.
coverage/) to .gitignore. (This also keeps it out of prettier/eslint, which respect .gitignore.)
- Before pushing, run
pnpm format then pnpm typecheck, pnpm lint, pnpm format:check, and pnpm test β CI now gates on all of these, so your vite.config.ts / package.json edits must be formatted.
π« Out of scope (stretch / later)
- Wiring coverage into CI (
.github/workflows/ci.yml) and uploading an lcov artifact β a reasonable stretch goal, but keep the first PR to local reporting unless you want to take it on.
- Enforced coverage thresholds β stick to report-only for now. We don't want CI immediately breaking.
β
Acceptance Criteria
Add Vitest coverage reporting so we can see how much of the codebase the tests exercise.
π§ Context
The project uses Vitest (
pnpm testβvitest run). Coverage is not enabled. Vitest has built-in coverage (the equivalent ofpytest-cov) via a provider package.The goal here is reporting only β print a coverage summary and generate an HTML report. Do not add an enforced threshold that fails the build. The test suite is still small, so a hard gate would just block PRs; a threshold can be added later once coverage is meaningful.
π οΈ Implementation Plan
pnpm add -D @vitest/coverage-v8(the default V8 provider β fast, native). This repo has security settings inpnpm-workspace.yaml; if the install is blocked by a policy error, flag it to Jacc rather than working around it.test:coveragescript topackage.json:vitest run --coverage.vite.config.tsundertest.coverage:provider: 'v8'reporter: ['text', 'html'](terminal summary + an HTML report)excludes:src/main.tsx,**/*.test.ts, config files (*.config.*), type-only files (src/types/**), and the test setup.pnpm test:coverageand confirm it prints a summary table and writes the HTML report.coverage/) to.gitignore. (This also keeps it out ofprettier/eslint, which respect.gitignore.)pnpm formatthenpnpm typecheck,pnpm lint,pnpm format:check, andpnpm testβ CI now gates on all of these, so yourvite.config.ts/package.jsonedits must be formatted.π« Out of scope (stretch / later)
.github/workflows/ci.yml) and uploading an lcov artifact β a reasonable stretch goal, but keep the first PR to local reporting unless you want to take it on.β Acceptance Criteria
pnpm test:coverageruns and prints a coverage summary in the terminal@vitest/coverage-v8is added as a devDependencytest.coverageis configured invite.config.tswith sensible excludespnpm typecheck,pnpm lint,pnpm format:check, andpnpm testall pass