This GitHub Action resolves a Jest coverage-summary file into simple percentage values.
Jest-Summary-Reader based on the CommonJS engine and is limited by Github Actions.
At first, you need to edit your jest settings file and add the following lines:
coverageReporters: [
"json-summary"
]
Then, you need to generate the coverage-summary.json
file in one of the possible ways, for example, using the command line argument:
jest --coverage
Finally, you need to specify the path to this file relative to the root directory of the project in your GitHub Actions, following the example:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Read Jest-Summary
id: jest-summary
uses: YakkaDev/jest-summary-reader@v1.0.0
with:
path: ./coverage/coverage-summary.json
- run: |
echo Coverage Average - ${{ steps.jest-summary.outputs.average }}
echo Coverage Functions - ${{ steps.jest-summary.outputs.functions }}
echo Coverage Lines - ${{ steps.jest-summary.outputs.lines }}
echo Coverage Statements - ${{ steps.jest-summary.outputs.statements }}
echo Coverage Branches - ${{ steps.jest-summary.outputs.branches }}
Detailed information on setting up Jest can be found directly on the Jest documentation page.
Below you will find all possible options of this application, as well as their description and default values.
Option | Description | Requried | Default |
---|---|---|---|
path | Path to coverage-summary file | Yes | - |
format | Extension of coverage-summary file | No | json |
Output | Description |
---|---|
average | Average percentage among all categories |
functions | The percentage value among all covered functions |
lines | The percentage value among all covered rows |
statements | The percentage value among all covered statements |
branches | The percentage value among all covered branches |
The following people participated in the development:
This project is released under the MIT License.
The application uses a @actions/core packages.