Karma转轮控制台 - 仅输出失败的测试 [英] Karma runner console - output only failed tests

查看:76
本文介绍了Karma转轮控制台 - 仅输出失败的测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是 Karma测试跑步者的默认输出(测试失败一次):

 
..
... $ b $是28.0(Windows):执行413的421(1 FAILED)$ b $是28.0(Windows):执行414 of 421(1 FAILED)$ b $是28.0(Windows):执行415的421(1失败)$ b $是28.0(Windows):执行416的421(1失败)$ b $是28.0(Windows):执行417的421(1 FAILED)
e 28.0(Windows):执行418的421(1失败)$ b $是28.0(Windows):执行419的421(1失败)$ b $是28.0(Windows):执行420的421(1 FAILED)$ b $ 28.0(Windows):421执行421(1失败)$ b $ 28.0(Windows):执行421 421(1失败)(1.74秒/ 1.091秒)

我不喜欢这样一个事实,即必须一直滚动到未能看到异常的测试。这可能会让人讨厌,所以我的问题是,是否有可能以某种方式更改输出,以便只在控制台中报告失败的测试?



因此,在一次测试失败的情况下,我希望输出类似于此:

  Chrome 28.0(Windows)FailedTest仅应打印到控制台FAILED 
ReferenceError:某些内容未定义
at null。< anonymous> (c:/SuperProject/src/test/FailedTest.js:10:10)
Chrome 28.0(Windows):执行71 of 421(1 FAILED)

而不是上面的输出。

解决方案

看着 http://karma-runner.github.io/0.10/config/configuration-file .html



您是否尝试将配置设置为使用空记者数组? Karma v0.10默认为 ['progress'] 的记者配置,这可能导致您的详细输出。



<你可能喜欢'点'记者。你可以在CLI上尝试使用

  karma start yourconfig.js --reporters dots 


This is default output of Karma test runner (with one failed test):

.
..  
...
e 28.0 (Windows): Executed 413 of 421 (1 FAILED)
e 28.0 (Windows): Executed 414 of 421 (1 FAILED)
e 28.0 (Windows): Executed 415 of 421 (1 FAILED)
e 28.0 (Windows): Executed 416 of 421 (1 FAILED)
e 28.0 (Windows): Executed 417 of 421 (1 FAILED)
e 28.0 (Windows): Executed 418 of 421 (1 FAILED)
e 28.0 (Windows): Executed 419 of 421 (1 FAILED)
e 28.0 (Windows): Executed 420 of 421 (1 FAILED)
e 28.0 (Windows): Executed 421 of 421 (1 FAILED)
e 28.0 (Windows): Executed 421 of 421 (1 FAILED) (1.74 secs / 1.091 secs)

I don't like the fact that one have to scroll all the way up to the test that failed to see an exception. This might get annoying over the time so my question is whether is it possible to somehow change the output so that only tests that failed would be reported in the console?

So in the case of one failed test I would prefer output similar to this:

Chrome 28.0 (Windows) FailedTest only should be printed to console FAILED
    ReferenceError: something is not defined
        at null.<anonymous> (c:/SuperProject/src/test/FailedTest.js:10:10)
Chrome 28.0 (Windows): Executed 71 of 421 (1 FAILED)

instead of the output above.

解决方案

Looking at http://karma-runner.github.io/0.10/config/configuration-file.html

Have you tried setting the config to use an empty reporters array? Karma v0.10 defaults to a reporters config of ['progress'], which is likely causing your verbose output.

You might like the 'dots' reporter. You can try it on the CLI using

karma start yourconfig.js  --reporters dots

这篇关于Karma转轮控制台 - 仅输出失败的测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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