此最小示例自定义chai断言应该失败。它不是。使失败的原因是什么?
const chai = require('chai');
chai.Assertion.addMethod('test1', function() {
this.assert(
false,
"Failed",
"Failed",
"foo",
"bar"
);
});
chai.expect({}).to.be.test1;
答案 0 :(得分:0)
test1必须被调用。如:
chai.expect({}).to.be.test1();