-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
Suppress console output in unit tests #28680
Conversation
0c304e4
to
063acb5
Compare
Comparing: 2aed507...6584708 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
Ideally we'd fix these tests to no longer log so that we can instead assert (maybe only in CI) that tests don't call console.log. |
Agreed! But until then, I think this is incrementally better. (We already mock and suppress logs like this in other tests.) |
Followup here: #28693 Two of these are specifically testing console.log behavior, but we can fix one of them to not use console.log. |
Followups to #28680 One of these test don't need to use `console.log`. The others are specifically testing `console.log` behavior, so I added a comment.
Followup to disallow unasserted console.log in CI here: #28708 |
Followups to facebook#28680 One of these test don't need to use `console.log`. The others are specifically testing `console.log` behavior, so I added a comment.
Followup from facebook#28693 and facebook#28680. In CI, we fail the test for any unasserted console.log. In DEV, we don't fail, but you can still use the matchers and we'll assert on them.
Summary
Changes all unit tests that were spewing console output via
console.log
to no longer do so.This will help reduce logspew and simplify parsing the reported Jest results.
How did you test this change?
See no more logspew when running unit tests.