Fix function coverage reporting showing incorrect 0% values in test coverage reports #13
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.
The test coverage reports were showing misleading function coverage data where all individual files displayed 0.0% function coverage, even though functions were actually being executed during tests and the overall summary showed 90.5% function coverage.
Problem
The coverage scripts relied on
lcov --listto display per-file coverage statistics, but this command has a known issue where it incorrectly shows 0.0% function coverage for individual files even when the underlying coverage data contains valid function execution information.Before:
This created confusion as the individual file percentages clearly didn't add up to the 90.5% overall coverage.
Root Cause
Investigation revealed that while
lcov --listwas showing 0.0% function coverage, the actual.infofile contained correct function execution data:FNF:28(28 functions found) andFNH:27(27 functions hit) for console.cFNDA:420,jsrt_console_logshowing actual function call countsgenhtmlcorrectly processed this data and showed accurate function coverageThe issue was specifically with how
lcov --listdisplays function coverage percentages in the per-file view.Solution
Modified both coverage scripts to parse the
.infofile directly instead of relying onlcov --list:SF:(source file),FNH:/FNF:(functions hit/found) entries directly(functions_hit / functions_found) * 100Result
Function coverage now displays accurate, realistic values:
The per-file percentages now properly reflect the actual function execution and align with the overall coverage summary, eliminating user confusion about the coverage data accuracy.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.