Skip to content

ci(coverage): add vitest v8 coverage with 70% line threshold#268

Merged
snipcodeit merged 1 commit intomainfrom
issue/257-add-vitest-coverage-reporting-with-70-pe
Mar 6, 2026
Merged

ci(coverage): add vitest v8 coverage with 70% line threshold#268
snipcodeit merged 1 commit intomainfrom
issue/257-add-vitest-coverage-reporting-with-70-pe

Conversation

@snipcodeit
Copy link
Owner

Summary

  • Configure vitest coverage with v8 provider — generates text, HTML, and lcov reports in coverage/
  • Enforce 70% line coverage threshold that causes npm run test:coverage to exit non-zero if violated
  • Add coverage/ to .gitignore and coverage badge to README
  • Include optional CI coverage upload step with continue-on-error: true for gradual ramp-up

Closes #257

Milestone Context

Changes

vitest.config.js (new)

  • Coverage provider: v8
  • Reporters: text, html, lcov
  • Output: ./coverage/
  • Threshold: lines: 70
  • Excludes: dist/, test files, config files, commands/, templates/, wiki/, docs/

package.json

  • Added devDependencies: vitest@^4.0.18, @vitest/coverage-v8@^4.0.18
  • Added script: "test:coverage": "vitest run --coverage"

.gitignore

  • Added coverage/ to exclude generated reports from git

README.md

  • Added coverage badge: [![Coverage](https://img.shields.io/badge/coverage-70%25-brightgreen)](./coverage/lcov-report/index.html)

.github/workflows/test.yml (new)

  • Node 18/20 matrix test run
  • Optional coverage run on node-20 (continue-on-error: true)
  • Coverage artifact upload via actions/upload-artifact@v4

Note: This PR includes test.yml alongside PR #267. If #267 merges first, a minor merge conflict on test.yml will need resolution — add the coverage steps to the existing file.

Test Plan

  • npm ci && npm run test:coverage completes without error
  • coverage/ directory is created with lcov-report/, lcov.info, and text output
  • git check-ignore -v coverage/ confirms coverage/ is gitignored
  • README.md shows the coverage badge
  • Modify a lib file to drop coverage below 70% — verify npm run test:coverage exits non-zero
  • CI workflow runs on push/PR and uploads coverage artifact on node-20

Cross-References

…hold

- Add vitest and @vitest/coverage-v8 devDependencies
- Create vitest.config.js with v8 provider, text/html/lcov reporters,
  70% line threshold, and coverage/ output directory
- Add test:coverage script (vitest run --coverage)
- Add coverage/ to .gitignore
- Add coverage badge to README.md
- Add test.yml with optional coverage upload step (continue-on-error)

Closes #257

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@snipcodeit snipcodeit force-pushed the issue/257-add-vitest-coverage-reporting-with-70-pe branch from 2fd7d6f to da56566 Compare March 6, 2026 11:24
@snipcodeit snipcodeit merged commit 47d538f into main Mar 6, 2026
@snipcodeit snipcodeit deleted the issue/257-add-vitest-coverage-reporting-with-70-pe branch March 6, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation changes github-config GitHub configuration changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add vitest coverage reporting with 70 percent line coverage threshold

1 participant