Skip to content

test: exclude test/** from coverage on every Node leg and ratchet thresholds to 99/96/98 - #262

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-coverage-ratchet
Oct 17, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-coverage-ratchet

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

npm test (scripts/run-tests.mjs) gates line/branch/function coverage on every CI leg (Node 22/24/26). Two problems surfaced while measuring:

  1. The legs were gating different aggregates. Node 24+ excludes test files from the --experimental-test-coverage report by default; Node 22 does not. On Node 22 the report included test/*.test.js, so the functions gate (97) had a 0.2-point margin (97.20%) while on Node 26 it had 2.4 — a harmless test-only refactor could have gone red on Node 22 alone. This PR passes --test-coverage-exclude=test/** so every leg measures dist/ + scripts/ only.
  2. Thresholds had not moved since [quality] pin subscribe SIGINT exit and add coverage-threshold script #71/test: enforce declared coverage thresholds when npm test runs on Node >= 22 [quality] #86 while coverage climbed. With all legs now measuring the same files (99.68 / 97.92 / 99.37 on both Node 22.23 and 26.10), the gate is ratcheted from 98/93/97 to 99/96/98.

A new runner test pins the thresholds CONTRIBUTING.md documents to the ones COVERAGE_FLAGS enforces, so the two cannot drift. CONTRIBUTING.md now describes npm test (Node ≥ 22) as the coverage gate, matching CI.

Deferred, not forgotten

package.json's test:coverage alias still carries the old flags (98/93/97, no exclude). #259 currently edits package.json and the hub refuses a second App-bot PR over the same file while it is open; the one-line alias update will follow once #259 lands. CI is unaffected — it runs the runner, not the alias.

Verification

  • Node 26.10: npm test → 341 pass, all files 99.68 / 97.92 / 99.37, exit 0
  • Node 22.23: node scripts/run-tests.mjs → 341 pass, all files 99.68 / 97.92 / 99.37, exit 0
  • Node 22.23 without the exclude at the new thresholds (control): 95.84% branch coverage does not meet threshold of 96%, 97.20% function coverage does not meet threshold of 98%

No changelog.d fragment: test-infrastructure only, no user-visible change.


Filed by quality agent (ACMM L4/L6 — full mode)

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

…esholds to 99/96/98

Node 24+ drops test files from the --experimental-test-coverage report by
default; Node 22 does not. The three matrix legs were therefore gating
different aggregates: on Node 22 the functions threshold (97) had a 0.2
point margin while on Node 26 it had 2.4. Pass --test-coverage-exclude so
every leg measures dist/ + scripts/ only, then ratchet lines/branches/
functions from 98/93/97 to 99/96/98 against the now-identical 99.68/97.92/
99.37 aggregate. A new runner test pins the thresholds CONTRIBUTING.md
documents to the ones the runner enforces.

The package.json test:coverage alias is left for a follow-up: an open PR
already edits package.json and the hub refuses a second App-bot PR over
the same file while it is open.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: quality <quality@hive.kubestellar.io>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 17, 2026
@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 17, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit 0c5594d into main Oct 17, 2026
12 of 13 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/test-coverage-ratchet branch October 17, 2026 03:48
@github-actions

Copy link
Copy Markdown

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants