Testing javascript with Mocha - how can I use console.log to debug a test?

后端 未结 5 2147
名媛妹妹
名媛妹妹 2020-12-13 16:31

I am using the javascript test-runner \"Mocha\".

I have a test that is failing, so I would to debug it using console.log.

But when the tests are

5条回答
  •  感情败类
    2020-12-13 17:21

    I had an issue with node.exe programs like test output with mocha.

    In my case, I solved it by removing some default "node.exe" alias.

    I'm using Git Bash for Windows(2.29.2) and some default aliases are set from /etc/profile.d/aliases.sh,

      # show me alias related to 'node'
      $ alias|grep node
      alias node='winpty node.exe'`
    

    To remove the alias, update aliases.sh or simply do

    unalias node
    

    I don't know why winpty has this side effect on console.info buffered output but with a direct node.exe use, I've no more stdout issue.

提交回复
热议问题