Skip to content

Report code test coverage of touched files within a Pull-Request inside the descriptions

Notifications You must be signed in to change notification settings

eleboys/test-coverage-report-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

About Action

This action will report test coverage summary of the pull-request touched files in the description. It works with the json coverage-summary generated by Istanbul reporter.

Inputs

token

Required The GitHub authentication token (workflows automatically set this for you, nothing needed here)

path

Required Path to the Istanbul 'coverage-summary.json' file in your repo

title

Required Title of the report

Outputs

summary

Summary of the report in json format. sample:

{
    "lines": { "total": 0, "covered": 0, "skipped": 0, "pct": 0 },
    "functions": { "total": 0, "covered": 0, "skipped": 0, "pct": 0 },
    "statements": { "total": 0, "covered": 0, "skipped": 0, "pct": 0 },
    "branches": { "total": 0, "covered": 0, "skipped": 0, "pct": 0 }
}

Preparation

Setup your test framework to use Istanbul to create coverage report as json file and thats it. just feed that file to this action as an input.

Example usage

on:
  pull_request:
    branches: [main, dev]

jobs:
  angular-test-coverage:
    runs-on: ubuntu-latest
    name: angular test coverage update
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Run Jasmine tests
        run: npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI

      - name: Coverage report
        uses: eleboys/test-coverage-report-action@v1.0.2
        id: report
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          path: coverage/coverage-summary.json
          title: Karma Test Coverage

      - name: Print the output summary
        run: echo "Report coverage json ${{ steps.report.outputs.summary }}"

About

Report code test coverage of touched files within a Pull-Request inside the descriptions

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published