Changed Code Coverage
Changed code coverage allows you to focus on the test coverage of your code changes.
Calculation Logic
- Use git diff to get
added lines
anddeleted lines
for each file - Traverse through the file’s coverage data, checking if
added lines
are covered inall dimensions
- Calculate the changed code coverage for a single file. Formula:
(number of added lines - number of uncovered lines) / number of added lines
💡
Tip
Many of the added lines
do not belong to any of the branches
, functions
, or statements
categories, but they are included in the calculation and are considered covered
by default.