-
-
Couldn't load subscription status.
- Fork 6.6k
fix(jest-reporters): print out console log for GHA reporter and group by test file #15864
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
base: main
Are you sure you want to change the base?
fix(jest-reporters): print out console log for GHA reporter and group by test file #15864
Conversation
… by test file Signed-off-by: hainenber <dotronghai96@gmail.com>
✅ Deploy Preview for jestjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
| ): string { | ||
| const TITLE_INDENT = | ||
| globalConfig.verbose === true ? ' '.repeat(2) : ' '.repeat(4); | ||
| globalConfig?.verbose === true ? ' '.repeat(2) : ' '.repeat(4); |
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.
I have to add verbose nullish check for double assurance
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.
when is it missing? types says it shouldn't be
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.
My bad, I was doing nullish check on globalConfig instead 😮💨 . Will revert in next revision.
Signed-off-by: hainenber <dotronghai96@gmail.com>
babel-jest
babel-plugin-jest-hoist
babel-preset-jest
create-jest
@jest/diff-sequences
expect
@jest/expect-utils
jest
jest-changed-files
jest-circus
jest-cli
jest-config
@jest/console
@jest/core
@jest/create-cache-key-function
jest-diff
jest-docblock
jest-each
@jest/environment
jest-environment-jsdom
@jest/environment-jsdom-abstract
jest-environment-node
@jest/expect
@jest/fake-timers
@jest/get-type
@jest/globals
jest-haste-map
jest-jasmine2
jest-leak-detector
jest-matcher-utils
jest-message-util
jest-mock
@jest/pattern
jest-phabricator
jest-regex-util
@jest/reporters
jest-resolve
jest-resolve-dependencies
jest-runner
jest-runtime
@jest/schemas
jest-snapshot
@jest/snapshot-utils
@jest/source-map
@jest/test-result
@jest/test-sequencer
@jest/transform
@jest/types
jest-util
jest-validate
jest-watcher
jest-worker
pretty-format
commit: |
Signed-off-by: hainenber <dotronghai96@gmail.com>
|
@SimenB not urgent but if you have time, can you review this PR? I have added E2E test and with testimonial from affected user. Thanks in advanced 🙏 |
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.
this is great, thanks! just some nits 🙂
CHANGELOG.md
Outdated
|
|
||
| - `[jest-runtime]` Fix issue where user cannot utilize dynamic import despite specifying `--experimental-vm-modules` Node option ([#15842](https://github.com/jestjs/jest/pull/15842)) | ||
| - `[jest-test-sequencer]` Fix issue where failed tests due to compilation errors not getting re-executed even with `--onlyFailures` CLI option ([#15851](https://github.com/jestjs/jest/pull/15851)) | ||
| - `[jest-reporters]` Fix issue where console output not displayed for GHA reporter even with `silent: false` option ([#15864](https://github.com/jestjs/jest/pull/15864)) |
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.
mind putting the entries alphabetically?
| const gha = new GitHubActionsReporter({} as Config.GlobalConfig, { | ||
| silent: false, | ||
| }); |
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.
you can use helpers from @jest/test-utils to create global and project configs
jest/packages/test-utils/src/config.ts
Lines 141 to 175 in 6813dfa
| export const makeGlobalConfig = ( | |
| overrides: Partial<Config.GlobalConfig> = {}, | |
| ): Config.GlobalConfig => { | |
| const overridesKeys = new Set(Object.keys(overrides)); | |
| for (const key of Object.keys(DEFAULT_GLOBAL_CONFIG)) { | |
| overridesKeys.delete(key); | |
| } | |
| if (overridesKeys.size > 0) { | |
| throw new Error(` | |
| Properties that are not part of GlobalConfig type were passed: | |
| ${JSON.stringify([...overridesKeys])} | |
| `); | |
| } | |
| return {...DEFAULT_GLOBAL_CONFIG, ...overrides}; | |
| }; | |
| export const makeProjectConfig = ( | |
| overrides: Partial<Config.ProjectConfig> = {}, | |
| ): Config.ProjectConfig => { | |
| const overridesKeys = new Set(Object.keys(overrides)); | |
| for (const key of Object.keys(DEFAULT_PROJECT_CONFIG)) { | |
| overridesKeys.delete(key); | |
| } | |
| if (overridesKeys.size > 0) { | |
| throw new Error(` | |
| Properties that are not part of ProjectConfig type were passed: | |
| ${JSON.stringify([...overridesKeys])} | |
| `); | |
| } | |
| return {...DEFAULT_PROJECT_CONFIG, ...overrides}; | |
| }; |
Co-authored-by: Simen Bekkhus <sbekkhus91@gmail.com>
Co-authored-by: Simen Bekkhus <sbekkhus91@gmail.com>
Signed-off-by: hainenber <dotronghai96@gmail.com>
|
CI is green now. PTAL when you have time. Thanks! |
Summary
Fixes #15747
The console output for each test result is already available and with proper conditions, we can display them out for better debugging UX
Before

After

Test plan