1 つは常にパスするように設計され、もう 1 つは常に失敗するように設計されています。
ここに私のスペックファイルがあります:
/* 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
私は何を間違っていますか?