有没有办法向传递给每个测试的 NodeUnittest
对象添加自定义断言?
我想做类似的事情:
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();
}