Does Jest swallow console.log statements? Is there a way to change this?

后端 未结 5 1782
闹比i
闹比i 2021-02-11 17:14

Does Jest swallow console.log output?

// __tests__/log.test.js

it(\'logs\', () => {
  console.log(\'hey\') // expect to see \"hey\" printed in t         


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-11 17:31

    The problem is that I was using jest --forceExit. Jest's logging model saves all the logs and spits them out later. --forceExit causes the process to bail before it reaches the spit-out-logs point.

提交回复
热议问题