Skip to content

Commit 6ab67bf

Browse files
Add new default reporter for github actions (#13626)
1 parent 8884105 commit 6ab67bf

File tree

7 files changed

+991
-115
lines changed

7 files changed

+991
-115
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- `[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))
66
- `[jest-core]` Add newlines to JSON output ([#13817](https://github.com/facebook/jest/pull/13817))
7+
- `[@jest/reporters]` New functionality for Github Actions Reporter: automatic log folding ([#13626](https://github.com/facebook/jest/pull/13626))
78

89
### Fixes
910

docs/Configuration.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1278,12 +1278,12 @@ export default config;
12781278

12791279
#### GitHub Actions Reporter
12801280

1281-
If included in the list, the built-in GitHub Actions Reporter will annotate changed files with test failure messages:
1281+
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'`:
12821282

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

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

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

12991299
export default config;

packages/jest-core/src/TestScheduler.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,10 @@ class TestScheduler {
347347
: this.addReporter(new DefaultReporter(this._globalConfig));
348348
break;
349349
case 'github-actions':
350-
GITHUB_ACTIONS && this.addReporter(new GitHubActionsReporter());
350+
GITHUB_ACTIONS &&
351+
this.addReporter(
352+
new GitHubActionsReporter(this._globalConfig, options),
353+
);
351354
break;
352355
case 'summary':
353356
summary = true;

0 commit comments

Comments
 (0)