Skip to content
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

Investigate using --silent flag in jest instead of mocking console.{log,warn,error} #4511

Open
ThatOneBro opened this issue May 4, 2024 · 0 comments

Comments

@ThatOneBro
Copy link
Member

ThatOneBro commented May 4, 2024

This would prevent a lot potentially useful log statements being hidden by use of global console.log = jest.fn() like we have in many places throughout the tests. At dev time we would see them by default, at CI time we can globally hide all log statements in terminal output.

Instead of using console.log = jest.fn() in most of those places, we should probably instead be calling const consoleLogSpy = jest.spyOn(console, 'log') and consoleLogSpy.mockRestore() when we are done. This will ensure that our spying does not interfere with default logging behavior while simultaneously allowing us to ignore it with --silent in CI.

@ThatOneBro ThatOneBro added this to the Milestone Quality milestone May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant