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

后端 未结 5 664
借酒劲吻你
借酒劲吻你 2021-02-11 17:00

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:57

    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.

提交回复
热议问题