test_runner: mark ignored lcov branches covered#63371
Draft
Sean-Kenneth-Doherty wants to merge 1 commit into
Draft
test_runner: mark ignored lcov branches covered#63371Sean-Kenneth-Doherty wants to merge 1 commit into
Sean-Kenneth-Doherty wants to merge 1 commit into
Conversation
Collaborator
|
Review requested:
|
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.
Fixes #61586.
When a
node:coverage ignore nextdirective covers an unexecuted branch body, the line entry is omitted from LCOV but the branch entry is still emitted as uncovered. This makes LCOV branch totals fail even though the branch points only at ignored source.This change detects zero-count branch ranges whose only uncovered source is ignored or non-executable scaffolding, then reports that branch as covered. The LCOV output keeps
BRFstable while movingBRHand the matchingBRDAentry to covered, matching the ignore behavior expected by the issue and by c8-style output.A focused regression fixture covers a truthy-only branch with an ignored falsy return and asserts the LCOV report has no zero-count
BRDA, reportsBRF:3/BRH:3, and still omits the ignored return fromDA.Checks run locally:
node --check lib/internal/test_runner/coverage.jsnode --test --test-name-pattern "lcov reporter excludes ignored branch ranges" test/parallel/test-runner-coverage.js(fails against the installed system Node before this patch, showing the staleBRDA:...,0/BRH:2behavior)tools/eslint/node_modules/eslint/bin/eslint.js --cache --max-warnings=0 --report-unused-disable-directives --no-warn-ignored lib/internal/test_runner/coverage.js test/parallel/test-runner-coverage.js test/fixtures/test-runner/coverage-ignored-branch.js test/fixtures/test-runner/coverage-ignored-branch.test.jsgit diff --cached --checkI attempted a local built-binary verification as well, but this environment could not complete a Node build before hitting temporary-space/toolchain constraints; CI should exercise the patched binary path.