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

后端 未结 5 1781
闹比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:55

    This seems to be an ongoing issue.

    With Node 10.7.0 and Jest 23.4.1, adding verbose: false to the jest config (per this suggestion) worked for me.

    Edit

    Now that I've gone to Jest 23.6 I also need to pass TERM=dumb as an environment variable, per Tamlyn's answer.

提交回复
热议问题