From e4a9fdd2186b747f829613a389d8825a08e91e4f Mon Sep 17 00:00:00 2001 From: quality Date: Sat, 17 Oct 2026 04:32:13 -0400 Subject: [PATCH] test(coverage): raise the unit coverage floor to 99/99/99/99 and fix the documented values main reaches 100 / 99.7 / 100 / 100 (lines / branches / functions / statements) while vitest.config.mjs gated build-test at 95 / 93 / 98 / 95, leaving ~120 lines of slack before a regression fails. Set the floor just under the current figure, the same rule as #202 and #484, and correct docs/contributing.md, which still listed the pre-#202 values 85/83/91/85. Closes #499 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality --- docs/contributing.md | 2 +- vitest.config.mjs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/contributing.md b/docs/contributing.md index 297cabd1..348958f4 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -45,7 +45,7 @@ stay in step with `action.yml` and the label catalogue. | Command | What it runs | |---------|--------------| | `npm test` | The whole Vitest suite | -| `npm run test:coverage` | The suite with v8 coverage; CI enforces the thresholds in `vitest.config.mjs` (lines 85, branches 83, functions 91, statements 85) | +| `npm run test:coverage` | The suite with v8 coverage; CI enforces the thresholds in `vitest.config.mjs` (lines 99, branches 99, functions 99, statements 99, a floor set just under what `main` reaches) | | `npx vitest run __tests__/bundle` | Only the bundle acceptance harness | | `npm run test:coverage:e2e` | Only the bundle acceptance harness, run against a source-mapped bundle built from `__tests__/bundle/coverageEntry/` into `.coverage-bundle/` so its hits are reported against `src/`, written to `coverage-e2e/` so it never overwrites the unit run's `coverage/` (ncc's map is line-only, so the build also emits tsc's per-file maps into `.coverage-bundle/tsc/` and `coverageEntry/remap.mjs` composes their columns into it; without that, inner lines of a multi-line expression that tsc flattens onto one JS line report 0 hits). This is end-to-end-only coverage and is deliberately reported separately from `test:coverage`: the unit run already reaches every line, so a union would say nothing about what the bundle exercises, and the two runs' statement and branch maps come from different transforms (vite vs. tsc+webpack) and do not combine. Fails below 99 % lines / 95 % branches / 98 % functions / 99 % statements (`vitest.e2e-coverage.config.mjs`), a floor set just under what `main` reaches so a scenario that stops driving a `src/` path is caught | diff --git a/vitest.config.mjs b/vitest.config.mjs index e0c3469b..ea259fb1 100644 --- a/vitest.config.mjs +++ b/vitest.config.mjs @@ -17,11 +17,13 @@ export default defineConfig({ include: ['src/**/*.ts'], // lcovonly + json-summary are machine-readable for CI artifacts and job summaries reporter: ['text', 'text-summary', 'lcovonly', 'json-summary'], + // Regression floor set just under what main reaches (100 / 99.7 / 100 / 100 + // at 1062ce7) so a drop of about one point fails build-test. thresholds: { - lines: 95, - branches: 93, - functions: 98, - statements: 95, + lines: 99, + branches: 99, + functions: 99, + statements: 99, }, }, },