Created
October 12, 2010 21:51
-
-
Save bentomas/622994 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var numTests = 0 | |
, callback | |
, check = function() { | |
if (numTests == 3 && callback) { | |
callback(); | |
} | |
} | |
; | |
module.exports = { | |
'test A': function(test) { | |
test.ok(true); | |
numTests++; | |
check(); | |
test.finish(); | |
}, | |
'test B': function(test) { | |
test.ok(true); | |
setTimeout(function() { | |
numTests++; | |
check(); | |
test.finish(); | |
}, 500); | |
}, | |
'test C': function(test) { | |
test.ok(true); | |
setTimeout(function() { | |
numTests++; | |
check(); | |
test.finish(); | |
}, 500); | |
}, | |
'test D': function(test) { | |
callback = function() { | |
test.ok(true); | |
test.finish(); | |
} | |
// just in case things are run serially, check to see if we need run our | |
// last test already | |
check(); | |
} | |
}; | |
if (module == require.main) { | |
require('../lib/async_testing').run(__filename, process.ARGV); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment