Repository navigation
test(coverage): cover the coverage-run CLI's non-Error rejection fallback - #1174
Merged
Merged
Conversation
…back tests/tools/e2e-coverage-run.mjs reports a rejection as `error.stack ?? error`. The existing CLI case spawns the tool with an unknown command, where main() throws an Error, so it covers the `error.stack` side and leaves the `?? error` fallback as the file's only uncovered region (98.65% of regions, line 211). The fallback is what .github/workflows/ci.yml depends on for its diagnostic: it runs this tool as `node tests/tools/e2e-coverage-run.mjs init|seal`, and a rejection that is not an Error has no .stack, so without the fallback the End-to-end coverage job's log would read `undefined` and nothing else. Reaching it needs main() to reject with a stackless value, which the tool's own code never does. A --import prelude makes the one host call on the success path -- the process.stdout.write() of the manifest -- throw a bare string, so the rejection arrives at the entrypoint in exactly the shape a non-Error would. The init succeeds first, keeping the case about the reporting path rather than about the command. tests/tools/e2e-coverage-run.mjs now reports 100% region coverage. Closes #1173 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
Merged
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
Adds one case to
tests/e2e-coverage-run.test.mjscovering the?? errorfallback in the CLI entrypoint of
tests/tools/e2e-coverage-run.mjs:The existing sibling case (
tests/e2e-coverage-run.test.mjs:229) spawns thetool with a bogus command, where
main()throwsnew Error(...). That coversthe
error.stackside and left the fallback beside it as the file's onlyuncovered region.
Why the fallback matters.
.github/workflows/ci.yml:231and:248run thistool as a command, and its stderr is the only account the
End-to-end coveragejob gives of why it stopped. A rejection that is not an
Errorhas no.stack;without the fallback that log would read
undefinedand nothing else.How the case reaches it. Every
throwin the tool isnew Error(...), somain()never rejects with a stackless value on its own. A--importpreludemakes the one host call
main()issues on its success path — theprocess.stdout.write()of the manifest — throw a bare string, so the rejectionarrives at the entrypoint in exactly the shape a non-
Errorwould. Theinititself succeeds first, which keeps the case about the reporting path rather than
about the command; the test asserts that by reading the manifest back.
The case asserts exit status 1, that stderr carries the thrown value, and
explicitly that stderr does not contain
undefined— the failure mode thefallback exists to prevent.
Verification
TZ=UTC node tests/tools/coverage-report.mjs(node v26.10.0), run locally onthis branch:
tests/tools/e2e-coverage-run.mjs100.00 | 98.65 | 211100.00 | 100.00npm run test:unit:coverage:checkexits 0 on this branch. No threshold inpackage.json:70is changed, and no workflow file is touched.Scope
One new test case in one existing file. It does not edit
tests/tools/e2e-coverage-report.mjsortests/e2e-coverage-report.test.mjs(#1163),
tests/tools/e2e-data-fixtures.cjs,tests/e2e/fixtures/data-variants/metrics.jsonortests/e2e-data-fixtures.test.mjs(#1171),tests/architecture-content-mirror.test.mjs(#1165),scripts/audit-gate.mjs(#1161), or
CONTRIBUTING.md(#1166).Related Issue
Closes #1173
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88