make 'assert.calls' short circuit on function call

This commit is contained in:
Brian Carlson 2010-12-02 17:48:39 -06:00
parent f0291d30d7
commit d4ac9b4024

View File

@ -84,12 +84,13 @@ assert.length = function(actual, expectedLength) {
var expect = function(callback) {
var executed = false;
setTimeout(function() {
var id = setTimeout(function() {
assert.ok(executed, "Expected execution never fired");
}, 1000)
return function(err, queryResult) {
executed = true;
clearTimeout(id);
assert.ok(true);
callback.apply(this, arguments)
}
}