Repository navigation
test(e2e): cover the istanbul readers in e2e-coverage-report.mjs - #1211
Merged
Merged
Conversation
The four module-private readers in tests/tools/e2e-coverage-report.mjs -- getLineCoverage, getRegionCoverage, isPhantomRegion and isContradictedRegion -- carry guards against malformed istanbul objects. Those objects are built inside the module by v8-to-istanbul from the V8 payload, so no capture artifact written at the public boundary can reach a guard; 13 regions survived every probe driven through collectE2ECoverage. Export the four readers for tests and drive their guards directly with hand-built istanbul objects. Record the regions that remain unreachable even so -- AnyMap internals, v8-to-istanbul's own converter fields, and two non-Error rejection paths in main() -- as an in-file note naming each by function and expression rather than by line. tests/tools/e2e-coverage-report.mjs: 93.65% -> 96.28% regions, lines unchanged at 100.00%. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <quality@hive.kubestellar.io>
Contributor
Author
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will keep the |
This was referenced Oct 8, 2026
Member
|
Heads-up: PRs 1233 1240 also edit |
This was referenced Oct 10, 2026
Merged
mrbobbytables
added a commit
to mrbobbytables/endusers
that referenced
this pull request
Oct 11, 2026
…ide the harness floor (cncf#1287) Resolves cncf#1253 by the same route cncf#1211 took for cncf#1210: document the unreachable fallbacks rather than delete them or add an ignore marker. tests/tools/e2e-coverage-report.mjs sits at 97.98% regions and every one of its 10 uncovered regions is a defensive fallback no test can reach. The in-file note already listed eight of them; this adds the two it predates (the second fallback on the resolvedSources chain, and the parts.length === 0 arm in splitRangeAtBoundaries from cncf#1240), states the resulting ceiling, and says how the list and the floor move together. tests/coverage-gate-thresholds.test.mjs records that ceiling next to --check-harness-file-regions so the floor cncf#1250 raised to 97 is never set above what the file can measure, and refreshes the measured numbers to the suite this commit ships. Signed-off-by: Bob Killen <bkillen@linuxfoundation.org> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test Improvement
Refs #1210 — the coverage work is done here, but the issue also asks for the
per-file region floor to be ratcheted and that single line cannot be written
yet (see Scope / overlap below), so the issue stays open to track it.
This takes #1210's option 1 (export the readers) for the part that option
covers, and its option 2 (record the residual) for the part it does not.
tests/tools/e2e-coverage-report.mjsexports onlysourcePathFromReference,collectE2ECoverage,renderE2ECoverageReport,writeE2ECoverageReportandmain. The guards inside its four module-private istanbul readers —getLineCoverage,getRegionCoverage,isPhantomRegionandisContradictedRegion— defend against malformed istanbul objects, andistanbul objects are built inside the module by
v8-to-istanbulfrom the V8payload. Reaching a guard from the public surface requires that library to emit
a shape it does not emit, which is why no probe driven through
collectE2ECoveragein #1208/#1209 could close them.Exported the four readers for tests (
tests/tools/e2e-coverage-report.mjs)and added
tests/e2e-coverage-report-readers.test.mjs— 19 tests driving theguards directly with hand-built istanbul objects:
getLineCoverage— absents; statements whose map entry is missing, has nostart, or has a non-integer line; the highest-count-wins fold on one line.getRegionCoverage— absentb; a branch with nobranchMapentry and onewith no
locations;null/empty/non-integer-line locations; theend/columndefaults; a branch with no counts array and one with a shortone.
isPhantomRegion— executed region, single-line zero, inverted span, thestatement-free line skipped mid-span, and the unexecuted line that keeps the
zero.
isContradictedRegion— executed region, no script recorded the zero, awitness with no executable line in the span, a witness that left a span line
unexecuted, a witness carrying a zero over the span, the same-script witness
that does contradict, and the other-script witness that is correctly ignored.
Recorded the residual that exporting cannot reach, as an in-file note at
the top of the module naming each entry by function and expression rather than
by line so it does not go stale:
normalizeSourceMap'smap.resolvedSources ?? …(@jridgewell/trace-mappinginternals),convertScript'sconverter.branches ?? {}/converter.functions ?? {}andthe
.map(([path]) => path)arm behind them,collectE2ECoverage'sconverted.coverage ?? {}andif (lineCoverage.size === 0) continue, andmain'serror.message ?? String(error)/error.stack ?? error.Measured
npm run test:unit:coverage, node v26.10.0, TZ=UTC, run locally at593b9fe(this branch's base):All-files regions 95.20 → 95.34. Full unit suite: 2105 tests, 0 failures.
npm run checkandnpm run test:unit:coverage:checkboth exit 0; Prettierclean.
Scope / overlap
tests/tools/e2e-coverage-report.mjsand one new test file.No open PR touches either. test(e2e): cover the e2e coverage reporter's partial-capture fallbacks #1209 adds
tests/e2e-coverage-partial-capture.test.mjsagainst the public surface;the regions it closes (
295-296 671 681 683 750at this tree) are disjointfrom the reader guards here and are deliberately not claimed by the in-file
note.
--check-harness-file-regionsto be ratcheted, but that flag does not existon
main— it is added by open PR test(coverage): give the tests/tools/ harness a floor of its own #1207 inpackage.json. Ratcheting ithere would collide with that PR over the same line. It should be raised to at
least
96in a follow-up once test(coverage): give the tests/tools/ harness a floor of its own #1207 lands.Filed by quality agent (hold-gated mode). Human review required.