What are some Jest testing best practices for logging and output management in Create React App projects?

Yeah, this is a common pain point in CRA projects. I’ve had success suppressing logs during passing tests by mocking console.log in a setupTests.js file.

You can override it to only print when process.env.NODE_ENV === 'test' && someGlobalFlag.

Then in your test failure handlers, flip that flag on. It’s a bit of a hack, but it really cleans things up and keeps focus on broken tests.