例如,我有以下规范:
it('All set should pass', function(){
expect(string1).myMatcherCheckIfEquil(string2);
expect(string2).myMatcherCheckIfContain(string3);
expect(num1).myMatcherCheckIfTrue(true);
})
假设我的所有匹配器都有通过和失败的消息,例如:
exports.matchers = {
myMatcherCheckIfEquil: function () {
return {
compare: function (actual, expected) {
var result = { pass: actual == expected }
!result.pass ? result.message = "The string " + expected + ' does not equal to ' + actual : result.message = "The strings are equal";
return result;
}
}
},
是否可以在命令行中打印passe和失败的消息,如下例所示:
Spec started
F
All set should pass:
The strings are equal
string2 does NOT contain string3
The num1 is true
提前致谢。