jest-github-actions-reporter

1.0.3 • Public • Published

Jest Reporter for GitHub Actions

A custom Jest reporter to create annotations when run via GitHub Actions.

Usage

All you have to do to get annotations in your GitHub Actions runs is to add the reporter your Jest configuration.

  1. Install npm install -D jest-github-actions-reporter
  2. Add to your jest.config.js:
module.exports = {
  reporters: [
    "default",
    "jest-github-actions-reporter"
  ],
  testLocationInResults: true
};

alternatively you can only add it during your CI build, for example in package.json:

{
    ...
    "scripts": {
        "citest": "CI=true jest --reporters=default --reporters=jest-github-actions-reporter"
    }
}

nothing else is required, no token sharing, no REST API calls etc.

Example

.github/workflows/CI.yaml

name: CI

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [10.x, 12.x]

    steps:
    - uses: actions/checkout@v1
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm ci
    - run: npm run build --if-present
    - run: npm citest
      env:
        CI: true

How does this work?

GitHub Actions supports a number of commands that allow you to provide rich experiences without custom REST API calls etc. See the docs for more information.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    165,735
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    165,735
  • 1.0.2
    8,315
  • 1.0.1
    3
  • 1.0.0
    2

Package Sidebar

Install

npm i jest-github-actions-reporter

Weekly Downloads

21,648

Version

1.0.3

License

ISC

Unpacked Size

284 kB

Total Files

7

Last publish

Collaborators

  • cschleiden