Skip to content

Instantly share code, notes, and snippets.

@ncb000gt
Created February 15, 2011 20:30
Show Gist options
  • Save ncb000gt/828182 to your computer and use it in GitHub Desktop.
Save ncb000gt/828182 to your computer and use it in GitHub Desktop.
Nodeunit setUp and tearDown wrapping.
var nodeunit = require('nodeunit');
function testCase(suite){
suite.setUp = function(test){
// your stuff
};
suite.tearDown = function(test){
// your stuff
};
return testCase.super_.call(this, suite);
}
sys.inherits(testCase, nodeunit.testCase);
exports.testCase = testCase;
var testCase = require('./nodeunit-testcase').testCase;
module.exports = testCase({
'my test': function(assert): {
assert.expect(1); //needed for async tests
assert.ok(true);
assert.done(); //needed for async tests
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment