Skip to content

Instantly share code, notes, and snippets.

@bentomas
Created October 12, 2010 21:51
Show Gist options
  • Save bentomas/622994 to your computer and use it in GitHub Desktop.
Save bentomas/622994 to your computer and use it in GitHub Desktop.
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