Skip to content

Add Vitest coverage reporting and a coverage badge - #216

Merged
jayqi merged 2 commits into
jyq/ci-all-greenfrom
jyq/coverage-badge
Nov 24, 2026
Merged

jayqi merged 2 commits into
jyq/ci-all-greenfrom
jyq/coverage-badge

Conversation

@jayqi

@jayqi jayqi commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Stacked on #215.

  • Adds @vitest/coverage-v8. It pins an exact vitest version as a peer dependency, and both are in the Dependabot dev-dependencies group, so they're updated together.
  • Configures V8 coverage over src/**/*.js. src/index.js stays excluded by its existing istanbul ignore file comment.
  • CI runs npm test -- --coverage, writes a per-file coverage table to the job summary, and uploads two artifacts: coverage-html with the HTML report, and coverage-json with coverage-final.json (statement-, branch-, and function-level hit counts) and coverage-summary.json (per-file percentages). Locally, npm test doesn't collect coverage; run npm test -- --coverage to get it.
  • Adds a Publish coverage badge job, following jayqi/python-package-reference. On pushes to main it force-pushes a shields.io endpoint JSON to a badges branch. The badge shows line coverage, rounded down. The job is left out of All green because it only runs on main.
  • Adds the badge to the README.

The badges branch doesn't exist yet. The first push to main after this merges creates it, and the README badge shows an error until then. Current coverage is 100%.

Assisted by Claude Code

Collect V8 coverage in CI, write a per-file table to the job summary, upload
the HTML report as an artifact, and publish a coverage badge to the badges
branch on pushes to main.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
@jayqi
jayqi added this pull request to stack #217 November 24, 2026 05:26
Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
@jayqi
jayqi merged commit 2d3b9ff into main Nov 24, 2026
9 checks passed
@jayqi
jayqi deleted the jyq/coverage-badge branch November 24, 2026 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant