ValentinH / jest-fail-on-console

Utility to make jest tests fail when console.error() or any other methods are used
MIT License
141 stars 20 forks source link

Add console.log support #6

Closed tvthatsme closed 2 years ago

tvthatsme commented 2 years ago

Thanks for this package! It's a great way to prevent the "Broken windows theory" in a project.

One thing that I am missing is the ability to fail the tests if console.log messages are present in the test output. I think it would be useful to add a flag to fail on logs just as it currently fails on errors and warnings. What do you think?

As authored currently, the failure is defaulted to true but I'd be happy to have it at the opt-in level to keep existing users happy.

ValentinH commented 2 years ago

Thanks for this PR, I think this is a good idea 🙂 I'd make the default to false to avoid creating a breaking change though.

tvthatsme commented 2 years ago

Yep, makes sense! I changed it to default as false. Let me know if you'd like to see any other changes.

ValentinH commented 2 years ago

This was published under v2.1.0! 🎉