Skip to content

Jest action adding checks with annotations to your pull requests and coverage table as comments

License

Notifications You must be signed in to change notification settings

willcaul/jest-github-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

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 Summary

Coverage Details

Check annotations example

Test Failure

Usage

You can now consume the action by referencing the v4 branch

uses: willcaul/jest-github-action@v4
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:

uses: willcaul/jest-github-action@v4
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

uses: willcaul/jest-github-action@v4
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

uses: willcaul/jest-github-action@v4
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.

uses: willcaul/jest-github-action@v4
env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
  working-directory: "frontend"

Credits

Thanks to mattallty/jest-github-action, which this package is forked from, as well as FirmNav/jest-code-coverage-commenter, which was used as a reference for the coverage comment format.

About

Jest action adding checks with annotations to your pull requests and coverage table as comments

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • TypeScript 90.8%
  • JavaScript 9.2%