How to test a Jest console.log?

Posted by Editorial Staff | Updated on

Want to test a Jest console.log? If you want to check that console.log received the right parameter (the one that you passed in) you should check mock of your jest.fn().

You also have to invoke your log function, otherwise console.log is never invoked:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers