Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dkershner6/jest-coverage-commenter-action
Comment on PRs with Jest Test Coverage Information
https://github.com/dkershner6/jest-coverage-commenter-action
github-actions hacktoberfest nodejs
Last synced: 29 days ago
JSON representation
Comment on PRs with Jest Test Coverage Information
- Host: GitHub
- URL: https://github.com/dkershner6/jest-coverage-commenter-action
- Owner: dkershner6
- License: apache-2.0
- Created: 2020-06-13T02:05:31.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-14T00:24:19.000Z (7 months ago)
- Last Synced: 2024-04-14T14:55:57.218Z (7 months ago)
- Topics: github-actions, hacktoberfest, nodejs
- Language: TypeScript
- Homepage:
- Size: 1.42 MB
- Stars: 13
- Watchers: 3
- Forks: 5
- Open Issues: 29
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Jest Coverage Commenter GitHub Action
GitHub Action to create a PR comment detailing how well test files are covering code. You can run whatever test command you want, but make sure it uses the coverage reporter to match your reporter input (see below).
## Usage
### Inputs
| key | default | required | description |
|-----|---------|----------|-------------|
| github_token | n/a | true | A GitHub Token, the standard one is great. |
| test_command | `npx jest --coverage` | false | The test command to run, that also runs coverage appropriately |
| reporter | `text` | false | Possible types: `text`, `text-summary`. Set your `--coverageReporters` to match. `text-summary` should be used on large projects. |
| comment_prefix | `## Jest Coverage` | false | The message preceeding coverage report |### Outputs
None
### Example Workflow
```yaml
on: pull_requestjobs:
test-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- run: npm i- name: Comment with Test Coverage
uses: dkershner6/jest-coverage-commenter-action@v2
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
test_command: "npm run test:coverage"
```## Reporter
For the standard `text` reporter, the most common jest coverageReporter, the comment on the PR looks like this, with expandable details:
![image](https://user-images.githubusercontent.com/25798427/110061018-ab82d800-7d1b-11eb-9ecc-05ac4ef22e6d.png)
For the `text-summary` reporter, you should run a jest command that includes `--coverageReporters=text-summary`. When this occurs and the reporter input is also set to `text-summary`, the PR comments looks like this:
![image](https://user-images.githubusercontent.com/25798427/110061175-f8ff4500-7d1b-11eb-8241-1c1bddc72c20.png)
## Contributing
All contributions are welcome, please open an issue or pull request.
To use this repository:
1. `npm i -g pnpm` (if don't have pnpm installed)
2. `pnpm i`
3. `npx projen` (this will ensure everything is setup correctly, and you can run this command at any time)
4. Good to make your changes!
5. You can run `npx projen build` at any time to build the project.