jasmine:如何显示匹配者的成功消息
例如,我有以下规范:jasmine:如何显示匹配者的成功消息,jasmine,jasmine-node,Jasmine,Jasmine Node,例如,我有以下规范: it('All set should pass', function(){ expect(string1).myMatcherCheckIfEquil(string2); expect(string2).myMatcherCheckIfContain(string3); expect(num1).myMatcherCheckIfTrue(true); }) 假设我的所有匹配程序都有通过和失败消息,例如: exports.matcher
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和failed消息,如以下示例所示:
Spec started
F
All set should pass:
The strings are equal
string2 does NOT contain string3
The num1 is true
提前谢谢