Skip to content

fix(coverage): handle empty branch locations in lcov generation - #44114

Merged
Devin Rousso (dcrousso) merged 2 commits into
microsoft:mainfrom
halcyon-past:fix-44113
Nov 17, 2026
Merged

Devin Rousso (dcrousso) merged 2 commits into
microsoft:mainfrom
halcyon-past:fix-44113

Conversation

@halcyon-past

Copy link
Copy Markdown
Contributor

Summary

  • Use optional chaining when accessing location.start?.line in CoverageReporter.lcovReport to prevent TypeError when Istanbul coverage data contains empty branch locations.
  • Fallback safely to branch.loc?.start?.line ?? branch.line ?? 0.

Fixes #44113

@brunnojob

Copy link
Copy Markdown

The new fixture exercises {} → branch.loc.start.line, but because branch.loc and branch.line are both 2 it does not pin the later branch.line ?? 0 fallback. Could you add a second branch-map fixture without loc but with line set? That would protect the compatibility fallback explicitly while keeping the generated BRDA output valid.

@halcyon-past

Copy link
Copy Markdown
Contributor Author

brunnodev (@brunnojob) Thanks for the review! I have added a second branch fixture without loc and with line: 3 to explicitly exercise the branch.line fallback in commit beb4d93.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

3 failed
❌ [chrome] › mcp/crash.spec.ts:31 › crash recovery › reports the navigation error, then resets and logs the crash @mcp-ubuntu-latest-chrome
❌ [chrome] › mcp/crash.spec.ts:58 › crash recovery › lists only one tab @mcp-ubuntu-latest-chrome
❌ [chrome] › mcp/crash.spec.ts:79 › crash recovery › marks non-current crashed tab in the tab list @mcp-ubuntu-latest-chrome

5232 passed, 631 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

2 failed
❌ [playwright-test] › reporter-junit.spec.ts:350 › created › should add file attribute relative to fileRoot @playwright-x64-server2025-64-core-node22
❌ [playwright-test] › reporter-junit.spec.ts:350 › merged › should add file attribute relative to fileRoot @playwright-x64-server2025-64-core-node22

1 flaky ⚠️ [firefox-library] › library/capabilities.spec.ts:105 › CA-008 should support webgl Radoslav Kirilov (@smoke) `@firefox-playwright-x64-ubuntu24-64-core-node22`

23643 passed, 716 skipped


Merge workflow run.

@dcrousso
Devin Rousso (dcrousso) merged commit 8b75237 into microsoft:main Nov 17, 2026
22 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: CoverageReporter throws TypeError on empty branch locations in lcov generation

3 participants