【发布时间】:2018-08-17 04:59:15
【问题描述】:
我正在将一个应用程序从 Sails.js v0.12 迁移到 v1.0,其中包括将 mocha 从 ^3.5.0 升级到 ^5.2.0。我认为这是问题的根源,但我似乎找不到解决办法。
以前,当测试失败时,mocha 报告器输出的末尾会有一个错误摘要:失败的具体断言、文件名、行号、错误消息等。现在,报告器正在着色it 块为红色,但未显示其他详细信息。
我尝试更改 mocha.opts 中的报告器,它适用于实际执行输出,但最后没有启用摘要。我错过了什么?
// ./test/integration/models/User.test.js
describe('User', () => {
describe('find()', () => {
it('should return an array of users', () => {
return User.find()
.then((users) => {
users.should.be.a('array');
true.should.be.false; // No problems if this is removed
});
});
});
});
在控制台中:
> node ./node_modules/mocha/bin/mocha test/lifecycle.test.js test/integration/**/*.test.js
√ OtherModel method() should do something: 17ms
1) User find() should return an array of users
'Done.'
PS C:\repos\myproject>
【问题讨论】: