Files
atomic-design-poc/docs/project/archive/backlog/WP-46-vitest-coverage.md
T
ehoandClaude Opus 5 12f17d9d73 docs: archive the finished backlogs (RD-30)
Two backlog trees are complete: `docs/project/backlog/` (75 files, every
WP done) and `docs/project/refactor-backlog-setup/` (the arc before it).
Move both under `docs/project/archive/` with `git mv`, so history stays
intact through `git log --follow`. `SHOWCASE-ROADMAP.md` moves with them,
because it points at the now-archived backlog README.

Add `docs/project/archive/README.md`. It states that these trees are
historical and names the two directories that are still live.

Repoint every inbound reference named in RD-30's Files table: CLAUDE.md,
the root README, both backend READMEs, `LetterHtml.cs`, `a11y.mdx`, the
`document-feature` and `new-ssp` skills, and the readable-codebase PLAN,
README, and RD-19 ticket. Fix two upward-relative links inside the moved
WP files (WP-68, WP-69) that gained a directory level and would otherwise
break. Repoint `.prettierignore`'s two agent-prompt exclusions to their
new path, so prettier keeps leaving those files' exact wording alone.

Mark RD-30 done and check off its acceptance criteria; flip its README
row to done.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-08 23:00:38 +02:00

2.3 KiB

WP-46 — Vitest coverage (report + thresholds)

Status: done Phase: 8 — platform/DX/showcase Priority: P1

Outcome

Coverage is first-class in the @angular/build:unit-test builder — no separate vitest config needed. Added a coverage configuration to the test target in angular.json (coverage: true, reporters text-summary/html/lcov, excludes for specs/stories/contracts/generated api-client.ts/main.ts/.d.ts) + @vitest/coverage-v8 (pinned to vitest's 4.1.9 to avoid the mixed-version warning). npm run test:coverageng test --configuration coverage. Report-only (no thresholds) per the ponytail default — visibility first. CI's test step now runs test:coverage (a strict superset of npm test: fails on a failing test, never on coverage). Baseline at delivery: ~71% statements / 69% branches / 68% functions / 74% lines. Output dir coverage/ was already git-ignored. Path to enforce later: add coverageThresholds to the config.

Why

Tests run via the @angular/build:unit-test (Vitest) builder but report no coverage — there's no visibility into what the house test rules actually cover. A template/showcase should surface this.

Decisions

  • Step 1 — verify wiring: confirm how coverage is enabled with the Angular unit-test builder (codeCoverage option and/or a vitest config), add @vitest/coverage-v8.
  • npm run test:coverage → text + HTML/lcov report.
  • Report-only first (ponytail: visibility before a blocking gate, like the semgrep job). Threshold focus on the layers the house rules already demand tests for (domain/**, pure combinators, parse* boundaries, reducers), not a blanket global %; exclude stories, the generated api-client.ts, and DTOs/contracts.
  • Wire into ci-local.sh/CI non-blocking, with a documented path to flip on enforcement later.
  • Open choice: report-only vs enforce a minimum now.

Files

  • package.json (test:coverage + dep), coverage config (builder option or vitest config).
  • scripts/ci-local.sh / .github/workflows/ci.yml — non-blocking coverage step.
  • .gitignore — ignore the coverage output dir.

Acceptance criteria

  • npm run test:coverage produces a report (text-summary + HTML/lcov) with sensible excludes.
  • Coverage runs in CI without failing the build (report-only).
  • npm run ci green.