Google Chrome浏览器可能在您不知情的情况下破坏了您的测试

by Robert Axelsen

罗伯特·阿克森(Robert Axelsen)

Google Chrome浏览器可能在您不知情的情况下破坏了您的测试 (Google Chrome might have broken your tests without you even knowing about it)

My colleague just discovered that Chrome 58 (released April 19th) has silently muted all console.debug() output in their Chrome Dev Tools.

我的同事刚刚发现Chrome 58(于4月19日发布)已在其Chrome开发工具中静默静音了所有console.debug()输出。

How? By making changes to the Console UI, from filtering based on type of console method to filtering based on levels.

怎么样? 通过更改控制台UI ,从基于控制台方法类型的筛选到基于级别的筛选。

Introducing levels is not a bad thing in and of itself. But Google also chose to stop showing all console output by default. Now you can only see level “Info” and below.

引入级别本身并不是一件坏事。 但是Google默认也选择停止显示所有控制台输出。 现在,您只能看到“信息”及以下级别。

Depending on your project, it might also be a big deal to no longer be able to filter by showing only one console method’s output.

根据您的项目,可能不再通过仅显示一个控制台方法的输出进行过滤也很重要。

For example only console.log(). This is particularly troublesome if you’re working on a larger project with hundreds of different types of output mixed together.

例如仅console.log() 。 如果您正在处理一个大型项目,将数百种不同类型的输出混合在一起,则这尤其麻烦。

As you can see from the comments section in the release notes, this has not been received well by developers.

发行说明的注释部分可以看出,开发人员对此并不满意。

测试失败 (Failing Tests)

This means that if your app or project relies on console.debug() level output for testing, your tests might have been failing for over a month without you even noticing.

这意味着如果您的应用程序或项目依赖console.debug()级别的输出进行测试,则您的测试可能已经失败了一个多月,甚至没有引起您的注意。

All without so much as a pop-up warning from Google.

所有这些都没有来自Google的弹出警告。

By making logging non-verbose by default, I believe Google has broken with best practice here, and made a huge mistake.

通过默认将日志记录设置为非冗长,我相信Google违反了此处的最佳做法,并犯了一个严重错误。

Also, removing the ability to only show output based on a specific console method has resulted in a worsened workflow for many developers.

此外,删除仅基于特定控制台方法显示输出的功能也导致许多开发人员的工作流程变糟。

自己测试一下 (Test it out for yourself)

I did some testing with the following console methods in Chrome Dev Tools:

我使用Chrome开发工具中的以下控制台方法进行了一些测试:

console.assert(true, {assert: "assert"});console.count('count');console.debug('debug');console.dir({dir: "dir"});console.error('error');console.info('info');console.log('log');console.profile('profile');setTimeout(function(){ console.profileEnd('profile'); }, 1000);console.table('table');console.time('time');setTimeout(function(){ console.timeEnd('time'); }, 1000);console.timeStamp('timeStamp');console.trace('trace');console.warn('warn');

You can simply copy paste this into the console in Chrome Dev Tools, hit enter, and change the filter level to see what is displayed in which level.

您可以简单地将其复制粘贴到Chrome Dev Tools中的控制台中,按Enter,然后更改过滤器级别以查看哪个级别显示了什么。

一些截图说明 (Some Screenshots To Illustrate)

Here are some screenshots to illustrate the differences between levels. Notice especially the first screenshot of default “Info” level, and the fact that “3 items are hidden.”

以下是一些屏幕截图,用于说明各个级别之间的差异。 特别要注意默认“信息”级别的第一张屏幕截图,以及“隐藏了3个项目”这一事实。

有什么想法吗? (Have Any Thoughts?)

What do you think about this change? Was Google in the wrong for making this change? Or do you think it was an improvement to the “Console UI” overall? Please leave a comment below.

您如何看待这种变化? Google做出此更改错了吗? 还是您认为这是对“控制台UI”整体的改进? 请在下面发表评论。

This article was originally published on “Hello, I Love Code” and is written by Robert Axelsen, who is a JavaScript Developer, Meetup Organizer and Open Source enthusiast based in Austria, Europe.

本文最初发表在“你好,我爱代码”上 ,由罗伯特·阿克塞尔森 ( Robert Axelsen )撰写,他是JavaScript开发人员,Meetup组织者和开放源代码爱好者,来自欧洲奥地利。

You can connect with Robert on Twitter, or get to know him better by visiting his website.

您可以在Twitter上与Robert联系,或者通过访问他的网站来更好地了解他

翻译自: https://www.freecodecamp.org/news/google-chrome-might-have-broken-your-tests-without-you-even-knowing-about-it-9d9130a6fd0c/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值