An open API service indexing awesome lists of open source software.

https://github.com/wopian/jest-reporter-github-annotations


https://github.com/wopian/jest-reporter-github-annotations

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

          

Jest Reporter GitHub Annotations


npm
npm
bundlephobia


checks
repoDependants
devDeps
sponsor

Report Jest test failures directly on pull requests with GitHub annotations

> [!IMPORTANT]
> [Jest 28](https://jestjs.io/blog/2022/04/25/jest-28) now includes a native GitHub Actions reporter. It is recommended to switch to the official GitHub Actions reporter, but this repository and package won't go away.
>
> Check out the [Jest blog post](https://jestjs.io/blog/2022/04/25/jest-28#github-actions-reporter) on how to setup the official Github Actions reporter on your projects!

## Install

```
yarn install -D @wopian/jest-reporter-github-annotations
```

## Usage

This reporter only outputs failing test results in GitHub's annotation format, so you must include the default Jest reporter to get human readable test results in the terminal logs.

### CLI (preferred)

Add it to your Jest script used by your GitHub Actions workflow in `package.json`:

```json
{
"scripts": {
"test": "jest --reporters=default --reporters=@wopian/jest-reporter-github-annotations",
}
}
```

### Jest Configuration

Or add it to your Jest configuration in `jest.config.js`:

```js
export default {
reporters: [
'default',
'@wopian/jest-reporter-github-annotations',
],
}
```

Or `package.json`:

```json
{
"jest": {
"reporters": [
"default",
"@wopian/jest-reporter-github-annotations",
],
}
}
```