Skip to content

test: cover the e2e reporter's source-reference resolution branches - #1072

Merged
mrbobbytables merged 1 commit into
mainfrom
quality/e2e-report-source-map-refs
Oct 5, 2026
Merged

mrbobbytables merged 1 commit into
mainfrom
quality/e2e-report-source-map-refs

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Covers five reachable branches in the reference-resolution path of
tests/tools/e2e-coverage-report.mjs — the containment gate that decides which
source files e2e coverage is attributed to. Test-only; no tooling change.

line branch new test
98 rel === '' in repoRelative sourcePathFromReference rejects a reference that resolves to the repository root
109 slash === -1 ? '' in sourcePathFromReference sourcePathFromReference rejects a webpack reference with no path after the authority
199, 202, 234 the three sourcesContent fallbacks in normalizeSourceMap collectE2ECoverage reads original content from disk when the map omits sourcesContent

Why these were worth pinning

  • 98 — isInside explicitly accepts the root directory itself (rel === ''
    at line 93). The only thing that then rejects the repository root as a
    source file is repoRelative returning null for an empty relative path.
    That arm had nothing holding it.
  • 109 — webpack://<authority> with no following slash must yield an empty
    path. Had it regressed to returning the unsliced value, the reference would
    have resolved against the map's own directory inside build/ rather than
    being rejected.
  • 199 / 202 / 234 — sourcesContent is optional in the source-map spec, but
    all 28 existing fixtures in this file supply it, so the entire
    no-sourcesContent path was unexercised. The new fixture declares both a
    src/ source and a node_modules/ source and omits sourcesContent
    entirely, so one assertion covers reading the src source from disk and
    blanking the external one.

Measured effect

npm run test:unit:coverage at 900592b, node v26.10.0, TZ=UTC:

regions uncovered lines in e2e-coverage-report.mjs
before 90.68% 98 109 188 199 202 234 255-256 301 303 318-319 322 325-327 329 331 405 408 410 424 485 495 497 509 520 549 565 708 751
after 92.23% 188 255-256 301 303 318-319 322 325-327 329 331 405 408 410 424 485 495 497 509 520 549 565 708 751

Exactly the five targeted regions left the list; nothing else moved. Repository
total 94.87% → 94.94% against the --check-regions 94 floor.

Line 188 (map.resolvedSources ?? flattened.sources ?? []) is deliberately left
alone — AnyMap always populates resolvedSources, so it appears unreachable
and is not claimed here.

Verification

  • node --test tests/e2e-coverage-report.test.mjs — 38 passed, 0 failed.
  • npm run test:unit:coverage:check — exit 0.
  • npx prettier --check tests/e2e-coverage-report.test.mjs — exit 0.

Scope note

This is a unit branch-coverage improvement in test tooling. It makes no
claim about any source path's end-to-end coverage: Playwright could not be
launched in this environment (chrome-headless-shell fails on a missing
libglib-2.0.so.0; installing it needs root), and a published e2e-coverage
artifact cannot be rendered without the build that produced it — the subject of
the already-open #1040.

Coordination

Appends to tests/e2e-coverage-report.test.mjs only; no .mjs tooling file is
touched, so there is no logic overlap with any open PR.

None of them touch sourcePathFromReference, repoRelative or
normalizeSourceMap. All of them also append to this test file, so the only
possible interaction is an append-order rebase.

Related Issue

Closes #1071

— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88

Five reachable branches in the path that decides which source files e2e
coverage is attributed to had no unit coverage:

  * repoRelative's empty-relative arm, the only thing that rejects a
    reference resolving to the repository root (isInside accepts it)
  * the empty-path arm for a webpack:// reference with no path after the
    authority
  * the three sourcesContent fallbacks, unexercised because every existing
    fixture supplies sourcesContent even though the source-map spec makes
    it optional

Regions in tests/tools/e2e-coverage-report.mjs rise 90.68% -> 92.23%, with
lines 98, 109, 199, 202 and 234 leaving the uncovered list and nothing else
changing. Test-only; no tooling change.

Closes #1071

Signed-off-by: quality <quality@hive.kubestellar.io>
@hivecommons-hive hivecommons-hive Bot added the hold label Oct 5, 2026
@hivecommons-hive

Copy link
Copy Markdown
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 outreach agent is always held because it publishes project-facing communication.

Hive will automatically remove the hold label once current policy no longer requires a level hold for "quality". If this is an outreach PR, a human must review it and remove the label.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] e2e reporter's source-reference resolution has five untested branches (repoRelative root, bare webpack authority, absent sourcesContent)

1 participant