Does Jest swallow console.log instructions? Is there any way to change this?

Does Jest give console.log swallowing?

 // __tests__/log.test.js it('logs', () => { console.log('hey') // expect to see "hey" printed in terminal }) // terminal output $ jest --forceExit PASS __tests__/log.test.js ✓ logs (1ms) # where "hey"? 

The main reason I care is that I write some things async beforeAll and afterAll , and I want to use console.log statements to debug the order of events.

+6
source share
1 answer

The problem is that I used jest --forceExit . The Jest logging model saves all logs and spits them out later. --forceExit causes the process to linger before it reaches the splash point.

+4
source

Source: https://habr.com/ru/post/1013079/


All Articles