Skip to content

Commit

Permalink
Add new default reporter for github actions (#13626)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoH2O1999 committed Jan 26, 2023
1 parent 8884105 commit 6ab67bf
Show file tree
Hide file tree
Showing 7 changed files with 991 additions and 115 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,7 @@

- `[expect, jest-circus, @jest/types]` Implement `numPassingAsserts` of testResults to track the number of passing asserts in a test ([#13795](https://github.com/facebook/jest/pull/13795))
- `[jest-core]` Add newlines to JSON output ([#13817](https://github.com/facebook/jest/pull/13817))
- `[@jest/reporters]` New functionality for Github Actions Reporter: automatic log folding ([#13626](https://github.com/facebook/jest/pull/13626))

### Fixes

Expand Down
6 changes: 3 additions & 3 deletions docs/Configuration.md
Expand Up @@ -1278,12 +1278,12 @@ export default config;

#### GitHub Actions Reporter

If included in the list, the built-in GitHub Actions Reporter will annotate changed files with test failure messages:
If included in the list, the built-in GitHub Actions Reporter will annotate changed files with test failure messages and (if used with `'silent: false'`) print logs with github group features for easy navigation. Note that `'default'` should not be used in this case as `'github-actions'` will handle that already, so remember to also include `'summary'`. If you wish to use it only for annotations simply leave only the reporter without options as the default value of `'silent'` is `'true'`:

```js tab
/** @type {import('jest').Config} */
const config = {
reporters: ['default', 'github-actions'],
reporters: [['github-actions', {silent: false}], 'summary'],
};

module.exports = config;
Expand All @@ -1293,7 +1293,7 @@ module.exports = config;
import type {Config} from 'jest';

const config: Config = {
reporters: ['default', 'github-actions'],
reporters: [['github-actions', {silent: false}], 'summary'],
};

export default config;
Expand Down
5 changes: 4 additions & 1 deletion packages/jest-core/src/TestScheduler.ts
Expand Up @@ -347,7 +347,10 @@ class TestScheduler {
: this.addReporter(new DefaultReporter(this._globalConfig));
break;
case 'github-actions':
GITHUB_ACTIONS && this.addReporter(new GitHubActionsReporter());
GITHUB_ACTIONS &&
this.addReporter(
new GitHubActionsReporter(this._globalConfig, options),
);
break;
case 'summary':
summary = true;
Expand Down

0 comments on commit 6ab67bf

Please sign in to comment.