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

EkoCommunications/jest-github-action

 
 

Repository files navigation

I want to sincerely thank mattallty for their initial work on the Jest Github Action. Their effort laid the groundwork for what we have achieved, and I am truly grateful for that.

Using their repository as a starting point has enabled us to enhance the action with new features. I appreciate the opportunity to build upon their work and improve it further.

A big thank you goes to mattallty for their invaluable contribution. Their original work has been essential to our project's development.

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

Check annotations example

Fail

Usage

You can now consume the action by referencing the v1 branch

uses: EkoCommunications/[email protected]
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: EkoCommunications/[email protected]
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: EkoCommunications/[email protected]
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: EkoCommunications/[email protected]
env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
  # code coverage will be reported, when this parameter or coverage-artifact-save is true
  coverage-comment: false

Running tests in a subdirectory

For running tests in folders other than root, supply a working-directory.

uses: EkoCommunications/[email protected]
env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
  working-directory: "frontend"

Saving code coverage results

For saving tests, supply a coverage-artifact-save

uses: EkoCommunications/[email protected]
env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
  # code coverage will be reported, when this parameter or coverage-comment is true
  coverage-artifact-save: true

Enabling multiple outputs support

For enabling multiple outputs/file types, supply multiple-outputs

uses: EkoCommunications/[email protected]
env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
  multiple-outputs: false

See the actions tab for runs of this action! 🌠

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 88.9%
  • JavaScript 11.1%