Does Jest swallow console.log
output?
// __tests__/log.test.js
it(\'logs\', () => {
console.log(\'hey\') // expect to see \"hey\" printed in t
I found a work around, despite the fact that sadly neither TERM=dumb
, nor verbose: false
nor upgrading to version 24 worked (I'm on 24.9). Just spy on the console, and you can see the results. Set it up with this:
const consoleSpy = jest.spyOn(console, 'log')
And then view the calls after running your tests using:
consoleSpy.mock.calls[0][0]