4
有没有方法可以将自定义断言添加到传递给每个测试的NodeUnit对象test
?如何在Nodeunit中添加自定义断言
我想这样做:
var Test = require('nodeunit').Test;
Test.prototype.customAssertion = function(obj) {
test.same(obj.foo, 'bar');
test.same(obj.bar, 'baz');
}
exports.test = function(test) {
test.customAssertion(obj);
test.done();
}