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

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

问题描述

我在内部通过 console.log() 完成了一些 NodeJS 日志记录(它实际上是

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

解决方案

谢谢@Anders Carstensen,我查看了 你提到的答案,它说:

<块引用>

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

我不能选择自己编写控制台,所以我现在只使用 Mocha/Sinon.

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?

解决方案

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

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

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天全站免登陆