-
Notifications
You must be signed in to change notification settings - Fork 526
Description
Workspace
code-coverage
📜 Description
The FileExplorer component displays incorrect coverage percentages for folders. While the "Missing lines" and "Tracked lines" columns are correctly aggregated, the "Coverage" percentage is calculated as a simple average of child coverage percentages instead of being derived from the aggregated line counts.
In FileExplorer.tsx, the buildFileStructure function (lines 102-106) calculates folder coverage as a simple average of child percentages:
coverage:
dataGroupedByPath[pathGroup].reduce(
(acc: number, cur: CoverageTableRow) => acc + cur.coverage,
0,
) / dataGroupedByPath[pathGroup].length,
This should instead calculate coverage from the aggregated missing and tracked values.
👍 Expected behavior
Folder coverage should be calculated as:
coverage = ((tracked - missing) / tracked) * 100
Using the displayed data: (2473 - 981) / 2473 = 60.33%
👎 Actual Behavior with Screenshots
The coverage shows 34.78% while the History section correctly shows 60.33%. The missing (981) and tracked (2473) line counts are correct, but the percentage doesn't match.
👟 Reproduction steps
- Upload a JaCoCo (or other) coverage report for an entity
- Navigate to the Code Coverage tab
- Compare the "History" section coverage with the "Explore Files" root folder coverage
📃 Provide the context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
- I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- I have read the Code of Conduct
Are you willing to submit PR?
Yes I am willing to submit a PR!