feat(test): WP-46 — Vitest coverage (report-only)
Enable coverage via the @angular/build:unit-test builder's first-class options: a `coverage` configuration on the test target (v8 provider, text-summary/html/lcov, excludes for specs/stories/contracts/generated client) + `npm run test:coverage`. Report-only (no thresholds) — visibility first. CI's test step now runs test:coverage (strict superset: fails on a failing test, never on coverage). Baseline ~71% stmts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -90,7 +90,7 @@ for its existing violations, so every WP ends green.
|
||||
| [WP-43](WP-43-scaffold-generators.md) | Runnable generators: value-object / form-machine / bff-endpoint / ui-component | 8 · platform/DX/showcase | todo |
|
||||
| [WP-44](WP-44-context-generator.md) | Runnable generator: `gen:context` | 8 · platform/DX/showcase | todo |
|
||||
| [WP-45](WP-45-create-ssp-generator.md) | `create-ssp` bootstrap generator (mechanise new-ssp) | 8 · platform/DX/showcase | todo |
|
||||
| [WP-46](WP-46-vitest-coverage.md) | Vitest coverage (report + report-only thresholds) | 8 · platform/DX/showcase | todo |
|
||||
| [WP-46](WP-46-vitest-coverage.md) | Vitest coverage (report + report-only thresholds) | 8 · platform/DX/showcase | done |
|
||||
|
||||
Sequencing dependencies (stated in the WPs too): 01 before 10–15 (axe covers story churn);
|
||||
03/04 before 05–09 (boundaries stop new violations during refactors); 06 before 07 (typed
|
||||
|
||||
@@ -1,9 +1,21 @@
|
||||
# WP-46 — Vitest coverage (report + thresholds)
|
||||
|
||||
Status: todo
|
||||
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:coverage` → `ng 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
|
||||
@@ -29,6 +41,6 @@ visibility into what the house test rules actually cover. A template/showcase sh
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
- [ ] `npm run test:coverage` produces a report (text + HTML/lcov) with sensible excludes.
|
||||
- [ ] Coverage runs in CI without failing the build (report-only).
|
||||
- [ ] `npm run ci` green.
|
||||
- [x] `npm run test:coverage` produces a report (text-summary + HTML/lcov) with sensible excludes.
|
||||
- [x] Coverage runs in CI without failing the build (report-only).
|
||||
- [x] `npm run ci` green.
|
||||
|
||||
Reference in New Issue
Block a user