Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattallty/jest-github-action
Jest action adding checks with annotations to your pull requests and coverage table as comments
https://github.com/mattallty/jest-github-action
action actions github-actions jest test testing
Last synced: 7 days ago
JSON representation
Jest action adding checks with annotations to your pull requests and coverage table as comments
- Host: GitHub
- URL: https://github.com/mattallty/jest-github-action
- Owner: mattallty
- License: mit
- Created: 2020-04-20T01:21:36.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T14:59:51.000Z (almost 2 years ago)
- Last Synced: 2024-10-08T16:00:38.795Z (30 days ago)
- Topics: action, actions, github-actions, jest, test, testing
- Language: TypeScript
- Homepage:
- Size: 1.29 MB
- Stars: 150
- Watchers: 5
- Forks: 51
- Open Issues: 31
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Jest Github Action
Main features:
- Add status checks with code annotations to your pull requests
- Comment your pull requests with code coverage table (if tests succeeded)## Coverage example
![Coverage](assets/coverage.png)
## Check annotations example
![Fail](assets/fail.png)
## Usage
You can now consume the action by referencing the v1 branch
```yaml
uses: mattallty/jest-github-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```### Overriding the test command
By default, this action will execute `npm test` to run your tests.
You can change this behavior by providing a custom `test-command` like this:```yaml
uses: mattallty/jest-github-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# this is just an example, this could be any command that will trigger jest
test-command: "yarn test"
```### Running tests only on changed files
```yaml
uses: mattallty/jest-github-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Runs tests related to the changes since the base branch of your pull request
# Default to false if not set
changes-only: true
```### Silencing the code coverage comment
```yaml
uses: mattallty/jest-github-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# To avoid reporting code coverage, set this variable to false
coverage-comment: false
```### Running tests in a subdirectory
For running tests in folders other than root, supply a working-directory.
```yaml
uses: mattallty/jest-github-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
working-directory: "frontend"
```See the [actions tab](https://github.com/mattallty/jest-github-action/actions) for runs of this action! :rocket: