-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting this started!
From #13626 (comment) I think ideally the As you noticed, there is no need to have groups in verbose output. So in And note that By the way, The workflow commands API is documented by GitHub (see the link above), it is stable and safe to use. Just trying to explain why it is good idea to avoid adding a dependency (; |
@mrazauskas One last question: what about the license? Do I have to put the license I used in my package somewere or is it unnecessary given the small amount of code? |
Not sure I fully understand what you mean. Robot shows that you have signed CLA (or Contributor License Agreement). That’s the agreement which covers all what you contribute to the repo. |
66609d2
to
8221653
Compare
@mrazauskas On another topic, this is now pretty much done so if you could give it a look and tell me if there's something you want me to change I would then proceed to move this pull request from the draft status. Thank you for your patience |
f5e5520
to
5eaf7cb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for the radio silence - I've been away on holiday 🙂
9b1626c
to
e4a8508
Compare
packages/jest-reporters/src/__tests__/GithubActionsLogsReporter.test.js
Outdated
Show resolved
Hide resolved
packages/jest-reporters/src/__tests__/GithubActionsLogsReporter.test.js
Outdated
Show resolved
Hide resolved
f636009
to
095d5d7
Compare
@MatteoH2O1999 is this complete from your side (pending CI which I just kicked off)? Asking as it's in draft 🙂 |
CI jobs ran, so I was looking at the output:
|
53e06c3
to
054d623
Compare
054d623
to
ba9b642
Compare
|
@SimenB with these last fixes I think this is ready for integration |
Thanks. Indeed there was a conflict with Did you notice that in the second screenshot there were no dots and no test tree at all? Only summary got printed. Was this because of the issues you mentioned? |
ba9b642
to
f7ea251
Compare
Yes, if a test suite had an undefined duration the reporter would crash, thus leading to that error. It is fixed now |
I'm not sure if expanding the capabilities of the bultin reporter should be considered breaking even if it might mean duplicate messages depending on user config. However, I'm happy to be a bit defensive and make a more explicit breaking change for our next major. |
I'm not allowed to push to this PR - @MatteoH2O1999 could you merge in main and apply this diff? diff --git c/CHANGELOG.md w/CHANGELOG.md
index 1a8e6b128f..3914ef60ec 100644
--- c/CHANGELOG.md
+++ w/CHANGELOG.md
@@ -2,6 +2,8 @@
### Features
+- `[@jest/reporters]` New functionality for Github Actions Reporter: automatic log folding ([#13626](https://github.com/facebook/jest/pull/13626))
+
### Fixes
- `[@jest/expect-utils]` `toMatchObject` diffs should include `Symbol` properties ([#13810](https://github.com/facebook/jest/pull/13810))
@@ -23,7 +25,6 @@
- `[jest-runtime]` Add `jest.isEnvironmentTornDown` function ([#13741](https://github.com/facebook/jest/pull/13741))
- `[jest-test-result]` Added `skipped` and `focused` status to `FormattedTestResult` ([#13700](https://github.com/facebook/jest/pull/13700))
- `[jest-transform]` Support for asynchronous `createTransformer` ([#13762](https://github.com/facebook/jest/pull/13762))
-- `[@jest/reporters]` New functionality for Github Actions Reporter: automatic log folding ([#13626](https://github.com/facebook/jest/pull/13626))
### Fixes
diff --git c/website/versioned_docs/version-29.4/Configuration.md w/website/versioned_docs/version-29.4/Configuration.md
index 0a071c26c7..eebddd8138 100644
--- c/website/versioned_docs/version-29.4/Configuration.md
+++ w/website/versioned_docs/version-29.4/Configuration.md
@@ -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;
@@ -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; I forgot to merge this before releasing 29.4, so I'm thinking to make a quick patch release with this 🙂 |
@SimenB I think now you should be able to push to the branch. Sorry about that |
Indeed, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @MatteoH2O1999, this is awesome stuff! 👍
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
As requested by @SimenB in jest-community/awesome-jest#115, this pull request aims to add a new default reporter for CI/CD use with Github Actions.
The solution proposed here is only a proposition: I remain open to all your suggestion in order to better integrate the new reporter into Jest.
Test plan
Unit tests