The „Quick start“ guide
This guide will teach you how to quickly configure and add Jest Coverage Report action to your project.
You can add this action for the new project, as well as for already existing one.
Setup
- Firstly, make sure that you've installed Jest. Also, if you're using TypeScript tests, be sure to install and configure ts-jest.
- Secondly, make sure that you can run the Jest without additional arguments. To test it, try to run this code in your shell:
Or via yarn:
If this command is not working for you, see how to setup custom testing script.
After that, create new file in your repository, under
.github/workflows
folder. Name this filecoverage-report.yml
(or any another name, just don't forget that extension must be.yml
).Paste the default configuration:
As you can see, one option is commented out - threshold
. After removing the hash character at the beginning of a line, the action will fail if the total line coverage in percent is less than the specified one. If you don't want this behavior, you can simply delete this line.
That's it! Now, try to create a pull request and wait until the report will be generated!