feat(coverage): add auto-updating test coverage badge#63
Merged
Conversation
Enable Vitest coverage (@vitest/coverage-v8) scoped to src/**/*.ts, add coverage and coverage:badge scripts, and generate resources/coverage-badge.svg from coverage/coverage-summary.json. A Husky pre-commit hook regenerates and stages the badge on every commit so the committed SVG always reflects the latest run, mirroring seamless-auth-api. Closes #49
Bccorb
added a commit
that referenced
this pull request
Jul 17, 2026
feat(coverage): add auto-updating test coverage badge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #49.
Summary
Adds a line-coverage badge to the README that stays in sync automatically, mirroring the approach in
seamless-auth-api.What's included
@vitest/coverage-v8and acoverageblock in vitest.config.ts. The testincludestayssrc/**/*.test.tsand coverageincludeissrc/**/*.ts, so the run never sweeps the Playwright specs underverify/(per the note on Add a dynamic test coverage badge, generated as part of the PR process #49).coverage(vitest run --coverage --fileParallelism=false) andcoverage:badge(node ./scripts/updateCoverageBadge.mjs, ported from the sibling repo).resources/coverage-badge.svg, generated fromcoverage/coverage-summary.json, referenced inREADME.mdas.pre-commithook regenerates and stages the badge on every commit, then rebuilds.coverage/is gitignored; only the SVG and README are committed.Decision (task: "which mechanism do we standardize on")
We went with the Husky pre-commit hook rather than a CI staleness check, matching
seamless-auth-apiso the two repos behave the same. This repo had no Husky before, sohuskyis added as a dev dependency and wired via thepreparescript. The hook is adapted to this repo's available scripts (it has no lint/format/typecheck scripts, so those steps from the sibling's hook are omitted):Documented in AGENTS.md under Conventions.
Checks
npm run buildpassesnpm testpasses (94 passed, 4 skipped)Current line coverage: 23.2%. No changeset: this is dev tooling and does not change the published CLI behavior.