Title: test_runner: node:coverage ignore comments exclude DA but leave BRDA in lcov output · Issue #61586 · nodejs/node · GitHub
Open Graph Title: test_runner: node:coverage ignore comments exclude DA but leave BRDA in lcov output · Issue #61586 · nodejs/node
X Title: test_runner: node:coverage ignore comments exclude DA but leave BRDA in lcov output · Issue #61586 · nodejs/node
Description: Version v24.13.0 Platform Darwin 24.6.0 (macOS) Subsystem test_runner What steps will reproduce the bug? Create a file with a branch and /* node:coverage ignore next */ comment: // src/example.js function getValue(condition) { if (condit...
Open Graph Description: Version v24.13.0 Platform Darwin 24.6.0 (macOS) Subsystem test_runner What steps will reproduce the bug? Create a file with a branch and /* node:coverage ignore next */ comment: // src/example.js f...
X Description: Version v24.13.0 Platform Darwin 24.6.0 (macOS) Subsystem test_runner What steps will reproduce the bug? Create a file with a branch and /* node:coverage ignore next */ comment: // src/example.js f...
Opengraph URL: https://github.com/nodejs/node/issues/61586
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"test_runner: node:coverage ignore comments exclude DA but leave BRDA in lcov output","articleBody":"### Version\n\nv24.13.0\n\n### Platform\n\nDarwin 24.6.0 (macOS)\n\n### Subsystem\n\ntest_runner\n\n### What steps will reproduce the bug?\n\n1. Create a file with a branch and `/* node:coverage ignore next */` comment:\n\n```javascript\n// src/example.js\nfunction getValue(condition) {\n if (condition) {\n return 'truthy';\n }\n /* node:coverage ignore next */\n return 'falsy';\n}\n\nmodule.exports = { getValue };\n```\n\n2. Create a test that only covers the truthy branch:\n\n```javascript\n// test/example.test.js\nconst { describe, it } = require('node:test');\nconst assert = require('node:assert');\nconst { getValue } = require('../src/example.js');\n\ndescribe('getValue', () =\u003e {\n it('should return truthy when condition is true', () =\u003e {\n assert.strictEqual(getValue(true), 'truthy');\n });\n});\n```\n\n3. Run with coverage:\n\n```bash\nnode --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test test/example.test.js\n```\n\n4. Examine the generated `lcov.info`\n\n### How often does it reproduce? Is there a required condition?\n\nAlways reproducible.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nThe `/* node:coverage ignore next */` comment should exclude **both**:\n- The DA (line coverage) entry for the ignored line\n- The BRDA (branch coverage) entry for the branch leading to the ignored code\n\nThis is the expected behavior because:\n1. The purpose of ignore comments is to exclude code from coverage calculations\n2. `c8` (which also uses V8 coverage) correctly handles this by marking both DA and BRDA as covered for ignored lines\n\n### What do you see instead?\n\n- **DA**: Line 6 (`return 'falsy';`) is correctly excluded from the lcov output\n- **BRDA**: Branch entry remains as uncovered: `BRDA:4,2,0,0`\n\n```\nBRDA:1,0,0,1\nBRDA:1,1,0,1\nBRDA:4,2,0,0 \u003c-- This branch should be excluded but remains as uncovered\nBRF:3\nBRH:2 \u003c-- Only 2 of 3 branches hit (66.67%)\nDA:1,1\nDA:2,1\nDA:3,1\nDA:4,1\nDA:5,0\nDA:7,1 \u003c-- DA:6 is missing (correctly excluded)\n...\n```\n\nThis causes branch coverage to report 66.67% instead of 100%, which impacts CI/CD pipelines that enforce branch coverage thresholds.\n\n### Additional information\n\n**Comparison with c8:**\n\nUsing `c8` with `/* c8 ignore next */` on the same code structure produces the correct result:\n\n```\nDA:5,1 # Line marked as covered (ignored)\nDA:6,1 # Line marked as covered (ignored)\nBRDA:5,2,0,1 # Branch marked as covered (ignored)\nBRF:3\nBRH:3 # All 3 branches \"hit\" (100%)\n```\n\n**Minimal reproduction repository:**\n\nhttps://github.com/tobigumo/node-coverage-brda-bug\n\n```bash\ngit clone https://github.com/tobigumo/node-coverage-brda-bug.git\ncd node-coverage-brda-bug\nnpm install\nnpm run test\n# Compare coverage/lcov-native.info (Node.js native - has bug) with coverage/lcov.info (c8 - correct)\n```","author":{"url":"https://github.com/tobigumo","@type":"Person","name":"tobigumo"},"datePublished":"2026-01-30T11:53:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/61586/node/issues/61586"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:58bae958-2290-7cc0-fab4-274618ac7323 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8B46:13A7CE:EBAB50:1435775:6A4DD25C |
| html-safe-nonce | ad73a31603afc942421285f6dd76930e4476e67abd401557f1df2d3d580b3cf3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjQ2OjEzQTdDRTpFQkFCNTA6MTQzNTc3NTo2QTRERDI1QyIsInZpc2l0b3JfaWQiOiI1NTA5Mzg3NjU3NDE3NzA4MTI0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a0a5414308d351723b0f934e1424577a787911b060ccccd8062bb080409179ba |
| hovercard-subject-tag | issue:3875372022 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/61586/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9f2f895cb6ead39fef531cf78f8fd4bb8889e0c1afdb08b1bb0a3448b215c41c/nodejs/node/issues/61586 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9f2f895cb6ead39fef531cf78f8fd4bb8889e0c1afdb08b1bb0a3448b215c41c/nodejs/node/issues/61586 |
| og:image:alt | Version v24.13.0 Platform Darwin 24.6.0 (macOS) Subsystem test_runner What steps will reproduce the bug? Create a file with a branch and /* node:coverage ignore next */ comment: // src/example.js f... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tobigumo |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1d344bdb7547fe6bca17a59bb2b8aac3dc9532a0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width