-
-
Notifications
You must be signed in to change notification settings - Fork 365
Open
Description
Issue:
I'm encountering a coverage inconsistency issue when merging nyc
coverage from unit and functional test runs in a JavaScript project.
Details:
- I use
nyc
to generate coverage reports separately for unit tests and functional tests. - Then I merge the
.json
reports usingnyc merge
and generate a combinedlcov.info
usingnyc report
. - When inspecting the merged LCOV file, I notice that for the same line (e.g., line 108), different test runs generate different BRDA block IDs:
Example:
-
Unit Test Coverage:
BRDA:108,11,0,17 BRDA:108,11,1,18 BRDA:108,12,0,35
-
Functional Test Coverage:
BRDA:108,14,0,0 BRDA:108,14,1,0 BRDA:108,15,0,0
This causes tools like SonarQube to treat the coverage as partial, even though unit tests already fully cover the branches. It appears the block numbers assigned to the same line change across different test runs when not all branches are executed.
Suspected Cause:
nyc
may be regenerating block/branch IDs independently for each run, and the merge process doesn't reconcile them into a consistent structure for accurate reporting.
Ask:
- Is there a way to preserve or align BRDA block IDs across test suites?
- Can
nyc
support a consistent branch mapping across multiple runs? - Any recommended approach to avoid incorrect partial coverage due to block mismatch?
Environment:
nyc
version: [fill in]- Node.js version: [fill in]
- OS: [fill in]
- Test Framework: Jest
Thanks!
hammzj
Metadata
Metadata
Assignees
Labels
No labels