gpt4 book ai didi

javascript - Karma 运行器控制台 - 仅输出失败的测试

转载 作者:行者123 更新时间:2023-12-03 02:20:45 29 4
gpt4 key购买 nike

这是 Karma 测试运行程序 的默认输出(有一个失败的测试):

.
..
...
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)

我不喜欢这样的事实:必须一直滚动到未能看到异常的测试。随着时间的推移,这可能会变得烦人,所以我的问题是是否可以以某种方式更改输出,以便只有失败的测试才会在控制台中报告?

因此,如果测试失败,我更喜欢类似于以下的输出:

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)

而不是上面的输出。

最佳答案

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

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

您可能喜欢“点”记者。您可以使用 CLI 在 CLI 上尝试

karma start yourconfig.js  --reporters dots

关于javascript - Karma 运行器控制台 - 仅输出失败的测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18121197/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com