【发布时间】:2018-06-25 22:46:40
【问题描述】:
有时在运行一组 mocha 测试时,我并不关心失败的细节;我只想要一个通过或失败的测试列表。我试过几个记者,但他们似乎都输出了失败的细节。我喜欢默认的规范报告器结构,但我找不到如何隐藏细节。
这是一个说明性示例。对于这些测试:
const assert = require('assert')
describe('test test', function() {
it('should pass', function() {
})
it('should fail', function() {
assert(false)
})
})
输出如下:
test test
✓ should pass
1) should fail
1 passing (9ms)
1 failing
1) test test
should fail:
AssertionError [ERR_ASSERTION]: false == true
+ expected - actual
-false
+true
at Context.<anonymous> (test-solution.js:69:5)
但我想要的只是这个:
test test
✓ should pass
1) should fail
1 passing (9ms)
1 failing
我是否遗漏了一些明显的东西,或者这些细节是我无法压制的?
【问题讨论】:
标签: javascript mocha.js