Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new default reporter for github actions #13626

Merged
merged 20 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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'],
MatteoH2O1999 marked this conversation as resolved.
Show resolved Hide resolved
};

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
Original file line number Diff line number Diff line change
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
Loading