Add @vitest/coverage-v8 with 80% branch coverage threshold to frontend build #121
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The frontend has no coverage measurement.
vitestis configured and running but@vitest/coverage-v8is not installed and no coverage thresholds are defined. We have no idea what percentage of frontend utility functions and component logic is actually tested.Why This Matters
Frontend business logic — date formatting, filename parsing, sort utilities, error message mapping — is exactly the kind of code that breaks silently when refactored. Without a coverage gate, new utility functions can ship untested and the CI pipeline will never flag it.
What Needs To Be Done
Install the coverage provider:
Add coverage configuration to
vite.config.ts:Add a coverage script to
package.json:Upload the lcov report as a CI artifact in the unit test job
Acceptance Criteria
npm run test:coveragefails if branch coverage drops below 80%src/lib/**(utils, components, error handling)Architect review (@mkeller): ⚠️ Right direction, two concerns before implementing.
Scope:
src/lib/**as the include covers Svelte components. Branch coverage on compiled Svelte components is noisier than on plain TypeScript — the Svelte compiler emits branches you didn't write, which skews the numbers. Start with a narrower include:src/lib/utils/**,src/lib/errors.ts, and any explicit utility modules. Expand once the baseline is stable and you understand what the compiler noise looks like.Sequencing: Same advice as #120 — measure the current baseline first, set the gate there, then ratchet up. Shipping an 80% gate you cannot currently meet will either break CI or get commented out. Neither outcome is useful.