jest-github-actions-reporter
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -12,3 +12,2 @@ "use strict"; | ||
onRunComplete(contexts, results) { | ||
command_1.issue("group", "JEST result"); | ||
if (results.numFailedTests > 0) { | ||
@@ -31,5 +30,4 @@ for (const testResults of results.testResults.filter(x => x.numFailingTests > 0)) { | ||
} | ||
command_1.issue("endgroup"); | ||
} | ||
} | ||
module.exports = GitHubActionsReporter; |
{ | ||
"name": "jest-github-actions-reporter", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Reporter for Jest that outputs GitHub Actions annotations", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -10,5 +10,6 @@ # Jest Reporter for GitHub Actions | ||
All you have to do to get annotations in your GitHub Actions runs is to add the reporter | ||
All you have to do to get annotations in your GitHub Actions runs is to add the reporter your Jest configuration. | ||
`jest.config.js`: | ||
1. Install `npm install -D jest-github-actions-reporter` | ||
2. Add to your `jest.config.js`: | ||
```js | ||
@@ -23,6 +24,3 @@ module.exports = { | ||
``` | ||
alternatively you can only add it during your CI build: | ||
`package.json` | ||
alternatively you can only add it during your CI build, for example in `package.json`: | ||
```json | ||
@@ -39,4 +37,34 @@ { | ||
## Example | ||
`.github/workflows/CI.yaml` | ||
```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](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions#set-an-error-message-error) for more information. |
@@ -1,2 +0,2 @@ | ||
import { issueCommand, issue } from "@actions/core/lib/command"; | ||
import { issueCommand } from "@actions/core/lib/command"; | ||
@@ -18,3 +18,2 @@ class GitHubActionsReporter implements jest.Reporter { | ||
) { | ||
issue("group", "JEST result"); | ||
if (results.numFailedTests > 0) { | ||
@@ -43,4 +42,2 @@ for (const testResults of results.testResults.filter( | ||
} | ||
issue("endgroup"); | ||
} | ||
@@ -47,0 +44,0 @@ } |
282744
67
81