0
我做了一對夫婦匹配器,一個設計爲總是通過,另一個設計爲總是失敗。Jasmine自定義匹配器不工作
這裏是我的規格文件:
/* 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
我在做什麼錯?