Skip to content

test(cli): comprehensive unit/integration/e2e coverage + CI-enforced gate - #2

Merged
paladini merged 1 commit into
mainfrom
test/comprehensive-cli-coverage
Jul 14, 2026
Merged

test(cli): comprehensive unit/integration/e2e coverage + CI-enforced gate#2
paladini merged 1 commit into
mainfrom
test/comprehensive-cli-coverage

Conversation

@paladini

@paladini paladini commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds @vitest/coverage-v8 with a mandatory coverage threshold (lines/statements 95%, functions 95%, branches 80%) wired into CI as npm run test:coverage — the build now fails if coverage regresses.
  • Switches the test suite to import from src/ instead of the compiled dist/ output (except cli.test.ts, which intentionally exercises the real built artifact via subprocess), so coverage numbers reflect actual source lines.
  • Closes real test gaps: score.ts's maturity-level boundary logic (exact-percent assertions for every L1–L4 requirement), all 19 previously-untested check IDs (including all 4 of skills.ts, which had zero direct tests), report/terminal.ts, report/markdown.ts, report/badge.ts, and index.ts's public export surface.
  • Adds a self-enforcing meta-test asserting every check ID in ALL_CHECKS has a direct test, so this can't silently regress.
  • Adds dimension roll-up and badge↔score integration tests, plus 6 subprocess-based end-to-end scenarios covering full real-world flows: fresh-repo scan (JSON+terminal+markdown+badge), baseline→diff→markdown, --min-level gating at the exact boundary, self-audit dogfooding of this repo, combined flags in one invocation, and malformed-input rejection.
  • Coverage moved from ~84% lines (with 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 thresholds
  • Verified the gate actually fails on a regression (temporarily inflated a threshold, confirmed non-zero exit, reverted)
  • npm run scan — repo still self-scores L4 · 108/108 (100%)
  • npm run lint (biome) — clean
  • npm run docs:build — clean

…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>
@paladini paladini self-assigned this Jul 14, 2026
@paladini
paladini merged commit 416a83e into main Jul 14, 2026
1 check passed
@paladini
paladini deleted the test/comprehensive-cli-coverage branch July 15, 2026 20:06
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