Skip to Content
DocumentationCore ConceptsChanged Code Coverage

Changed Code Coverage

Changed Code Coverage allows you to focus on the test coverage of the changed code.

Dimensions

New (File) Line Coverage

Calculation Logic:

  1. git diff between two commits => changed files => changed line numbers (may include comments and blank lines)
  2. Traverse the changed files’ coverageMap to check if the locations of branchMap, fnMap, and statementMap include the changed line numbers
  3. Covered definition: The branchMap, fnMap, and statementMap where the changed line numbers are located are all covered

Calculation Formula:

New (File) Line Coverage = Covered (File) Lines / Total New (File) Lines

New Branch Coverage

Calculation Logic:

  1. git diff between two commits => changed files => changed line numbers
  2. Traverse the changed files’ coverageMap to check if the locations of branchMap include the changed line numbers
  3. Covered definition: The branchMap where the changed line numbers are located is covered

Calculation Formula:

New Branch Coverage = Covered Branches / Total New Branches

New Function Coverage

Calculation Logic:

  1. git diff between two commits => changed files => changed line numbers
  2. Traverse the changed files’ coverageMap to check if the locations of fnMap include the changed line numbers
  3. Covered definition: The fnMap where the changed line numbers are located is covered

Calculation Formula:

New Function Coverage = Covered Functions / Total New Functions

New Statement Coverage

Calculation Logic:

  1. git diff between two commits => changed files => changed line numbers
  2. Traverse the changed files’ coverageMap to check if the locations of statementMap include the changed line numbers
  3. Covered definition: The statementMap where the changed line numbers are located is covered Calculation Formula:
New Statement Coverage = Covered Statements / Total New Statements