Skip to content

Warning

You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?

Test Coverage Reporter

Actions
Generate a coverage report based on a base/master coverage report
v1.0.7
Star (0)

Test Coverage Reporter

A github action that generates a comprehensive unit test coverage report, including optional diff with the branch the PR will merge into.

Screenshot

Usage

- uses: jgillick/test-coverage-reporter@v1
  with:
    coverage-file: coverage/coverage-final.json
    access-token: ${{ secrets.GITHUB_TOKEN }}

Inputs

  • coverage-file: Path to the test coverage report
  • base-coverage-file: Path to the coverage report to compare against. This is most likely from the branch you plan to merge into.
  • access-token: Required to comment on the PR
  • fail-delta: If coverage for any file is reduced by this much (in percent) the run will fail. (default: 0.2)
  • title: The coverage report title
  • custom-message: Add this custom text to the output.
  • strip-path-prefix: Remove this part of the path of the front of all file paths in the coverage report.

Compare coverage with base

You can easily see how this PR will either add or remove coverage from the branch it will be merging into by passing the base-coverage-file input.

- uses: jgillick/test-coverage-reporter@v1
  with:
    coverage-file: coverage/coverage-final.json
    base-coverage-file: main-branch/coverage/coverage-final.json
    access-token: ${{ secrets.GITHUB_TOKEN }}

See a full example in this repos workflow.

For larger test suites, it can be more performant to save the base coverage to a longer-lived artifact and use an action like actions-download-artifact to download it.

Also try

You might also like the Test Coverage Annotations action, which makes it easier to see which lines are lacking test coverage.

Test Coverage Annotation Screenshot

Acknowledgements

This action was inspired by the work of Jest coverage report and Jest Coverage Reporter Action.

Test Coverage Reporter is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Generate a coverage report based on a base/master coverage report
v1.0.7

Test Coverage Reporter is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.