Coverage Pattern
Code coverage configuration with Vitest including thresholds, per-file rules, CI integration, and coverage analysis tooling.
What's Included#
- Vitest V8 coverage provider with HTML, JSON, and lcov reporters
- Global and per-file coverage thresholds for lines, branches, and functions
- Istanbul and V8 ignore comments for untestable code paths
- CI coverage gates with GitHub Actions and Codecov integration
- Coverage report analysis script for finding low-coverage files and uncovered functions
Usage#
Via CLI#
Loading code block...
Via AI Assistant#
Ask your AI assistant:
- "Use the coverage pattern from Bootspring"
- "Apply the Bootspring coverage pattern to my project"
Key Considerations#
- Focus on meaningful coverage rather than chasing 100% which encourages low-quality tests
- Set 80% as a reasonable starting threshold and increase for critical code paths
- Use branch coverage to ensure all conditional paths are tested, not just lines
- Use ignore comments sparingly and only for legitimately untestable code
- Track coverage trends over time rather than treating it as a pass/fail gate
Related Patterns#
- Vitest - Test runner configuration
- Unit Testing - Unit testing patterns
- Integration Testing - Integration tests
- CI/CD - CI pipeline setup