我做了几个匹配器,一个设计为总是通过,另一个设计为总是失败。
这是我的规格文件:
/* my-spec.js */
beforeEach(function() {
var matchers = {
toPass: function() {
return {
compare: function(actual) {
return {
pass: true
};
}
};
},
toFail: function() {
return {
compare: function(actual) {
return {
pass: false
};
}
};
}
};
this.addMatchers(matchers);
});
describe("A suite", function() {
it("contains spec with an expectation", function() {
expect('this test').toPass();
expect('this test').toFail();
});
});
当我运行时jasmine-node tests
(我的文件在tests
文件夹中),我看到:
.
Finished in 0.018 seconds
1 test, 2 assertions, 0 failures, 0 skipped
我究竟做错了什么?