Skip to content

Commit

Permalink
Flip silent default value and fix worker shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoH2O1999 committed Jan 17, 2023
1 parent 095d5d7 commit 054d623
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ 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 and 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 pass `'silent: true'` as option (default is `false`):
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} */
Expand Down
15 changes: 9 additions & 6 deletions packages/jest-reporters/src/GitHubActionsReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,15 @@ export default class GitHubActionsReporter extends BaseReporter {

constructor(
_globalConfig: Config.GlobalConfig,
reporterOptions: {silent?: boolean} = {silent: false},
reporterOptions: {silent?: boolean} = {silent: true},
) {
super();
this.options = {silent: reporterOptions.silent || false};
this.options = {
silent:
typeof reporterOptions.silent === 'boolean'
? reporterOptions.silent
: true,
};
}

override onTestResult(
Expand Down Expand Up @@ -215,12 +220,10 @@ export default class GitHubActionsReporter extends BaseReporter {
root.passed = false;
passed = false;
}
if (!element.duration || isNaN(element.duration)) {
throw new Error('Expected duration to be a number, got NaN');
}
const duration = element.duration || 1;
root.children.push({
children: [],
duration: Math.max(element.duration, 1),
duration,
name: element.title,
passed,
});
Expand Down

0 comments on commit 054d623

Please sign in to comment.