Skip to content

Add new Jest --compact-console flag for DevTools tests #22495

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

Merged
merged 1 commit into from
Oct 5, 2021

Conversation

bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Oct 3, 2021

This flag uses CustomConsole (from @jest/console) to override default formatting and remove the logging source location (making the logs more compact and easier to read).

Default logging (remains unchanged)

Screen Shot 2021-10-03 at 12 57 22 PM

g console logging more compact).

Example with -c or --compact-console flag

Screen Shot 2021-10-03 at 12 53 28 PM

Note that this feature only supports the DevTools test targets because of the way reconciler tests mock console to verify that all expected warnings and errors were explicitly flushed before the end of the test.

This flag uses the @jest/console CustomConsole to override default formatting and remove the logging source location (making console logging more compact).
@facebook-github-bot facebook-github-bot added the React Core Team Opened by a member of the React Core Team label Oct 3, 2021
@sizebot
Copy link

sizebot commented Oct 3, 2021

Comparing: a4bc8ae...7e544a4

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 130.05 kB 130.05 kB = 41.34 kB 41.34 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 132.88 kB 132.88 kB = 42.31 kB 42.31 kB
facebook-www/ReactDOM-prod.classic.js = 412.54 kB 412.54 kB = 76.28 kB 76.28 kB
facebook-www/ReactDOM-prod.modern.js = 401.13 kB 401.13 kB = 74.56 kB 74.56 kB
facebook-www/ReactDOMForked-prod.classic.js = 412.54 kB 412.54 kB = 76.28 kB 76.28 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 7e544a4

Copy link
Contributor

@jstejada jstejada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh nice

@bvaughn bvaughn merged commit cadf94d into facebook:main Oct 5, 2021
@bvaughn bvaughn deleted the jest-compact-console-option branch October 5, 2021 15:58
@salazarm
Copy link
Contributor

salazarm commented Oct 5, 2021

Only DevTool tests support compactConsole flag.

😭

@bvaughn
Copy link
Contributor Author

bvaughn commented Oct 5, 2021

@salazarm We could make the other test targets support this too. We'd just need to overhaul the console mocking stuff a little but and I didn't have the time to dig into this on the train.

zhengjitf pushed a commit to zhengjitf/react that referenced this pull request Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants