test(cli): comprehensive unit/integration/e2e coverage + CI-enforced gate - #2
Merged
Merged
Conversation
…enforced gate packages/cli had 66 tests but no code-coverage tooling and 19 of 34 check IDs (all of skills.ts) with no direct test. Adds @vitest/coverage-v8 with a mandatory threshold gate wired into CI, switches the suite to import from src/ instead of dist/ so coverage reflects real source lines, and closes the gaps: score.ts boundary logic, every check ID, report/terminal.ts, report/markdown.ts, report/badge.ts, index.ts's export surface, dimension roll-up integration tests, and 6 subprocess-based end-to-end scenarios covering full user-facing flows (scan, diff, --min-level gating, dogfooding, combined flags, malformed input). Coverage moved from ~84% lines/0-10% on report/* to 97.46% lines, 100% functions, 83.95% branches; repo still self-scores L4/108/108. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
@vitest/coverage-v8with a mandatory coverage threshold (lines/statements 95%, functions 95%, branches 80%) wired into CI asnpm run test:coverage— the build now fails if coverage regresses.src/instead of the compileddist/output (exceptcli.test.ts, which intentionally exercises the real built artifact via subprocess), so coverage numbers reflect actual source lines.score.ts's maturity-level boundary logic (exact-percent assertions for every L1–L4 requirement), all 19 previously-untested check IDs (including all 4 ofskills.ts, which had zero direct tests),report/terminal.ts,report/markdown.ts,report/badge.ts, andindex.ts's public export surface.ALL_CHECKShas a direct test, so this can't silently regress.--min-levelgating at the exact boundary, self-audit dogfooding of this repo, combined flags in one invocation, and malformed-input rejection.report/*at 0–10%) to 97.46% lines, 100% functions, 83.95% branches.Test plan
npm run test:coverage— 161 tests pass, coverage gate passes against configured thresholdsnpm run scan— repo still self-scores L4 · 108/108 (100%)npm run lint(biome) — cleannpm run docs:build— clean