From 2737770c2312e9eacee88256f8141547330c5fcf Mon Sep 17 00:00:00 2001 From: quality Date: Thu, 15 Oct 2026 04:48:35 -0400 Subject: [PATCH] chore(coverage): give test:coverage:e2e a regression floor (99/95/98/99) instead of zeroed thresholds vitest.e2e-coverage.config.mjs pinned every threshold to 0, so a bundle scenario that stopped driving a src/ path lowered the e2e figure without failing anything. Set the floor just under main@d93ecb8 (99.54 lines / 96.25 branches / 98.79 functions / 99.56 statements) and note it in docs/contributing.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality --- docs/contributing.md | 2 +- vitest.e2e-coverage.config.mjs | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/contributing.md b/docs/contributing.md index e29e4e71..f5f47bbb 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -45,7 +45,7 @@ stay in step with `action.yml` and the label catalogue. | `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) | | `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 | +| `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 | Unit tests under `__tests__/` import `src/` directly and mock the GitHub API with [msw](https://mswjs.io/). The acceptance harness in `__tests__/bundle/` diff --git a/vitest.e2e-coverage.config.mjs b/vitest.e2e-coverage.config.mjs index f0c731de..bca64ffb 100644 --- a/vitest.e2e-coverage.config.mjs +++ b/vitest.e2e-coverage.config.mjs @@ -44,11 +44,14 @@ export default mergeConfig(base, defineConfig({ include: ['src/**/*.ts', '.coverage-bundle/index.js'], autoAttachSubprocess: true, excludeAfterRemap: true, + // Regression floor for the bundle-only run, set just under what main reaches + // (99.54 / 96.25 / 98.79 / 99.56 at d93ecb8) so a scenario that stops + // exercising a src/ path fails this run instead of silently lowering the figure. thresholds: { - lines: 0, - branches: 0, - functions: 0, - statements: 0, + lines: 99, + branches: 95, + functions: 98, + statements: 99, }, }, },