如何禁用Jest`console.log`标签 [英] How to disable Jest `console.log` tags

查看:435
本文介绍了如何禁用Jest`console.log`标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在内部通过console.log()完成了一些NodeJS日志记录(实际上是 loglevel ),如我所见,出于任何原因,Jest都用console.log ../path/to/string/with/console.log/call:line#标记console.log输出:

I have some NodeJS logging done via console.log() internally (its actually loglevel) and as I see it, Jest tags console.log output with console.log ../path/to/string/with/console.log/call:line# for whatever reason:

我在文档中没有找到任何相关选项.如何禁用它?

I haven't found any related options in the docs. How can I disable it?

推荐答案

感谢@Anders Carstensen,我看过

Thanks @Anders Carstensen, I've looked at the answer you mentioned and it says:

查看源代码对于Jest,似乎没有一种巧妙的方法可以关闭这些消息.

Looking at the source code for Jest, it doesn't seem like there is a neat way to turn those messages off.

我不能选择编写自己的控制台,因此我现在只坚持使用Mocha/Sinon.

Not an option for me to write my own console, so I'll just stick with Mocha/Sinon for now.

这篇关于如何禁用Jest`console.log`标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆