Created
February 15, 2011 20:30
-
-
Save ncb000gt/828182 to your computer and use it in GitHub Desktop.
Nodeunit setUp and tearDown wrapping.
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 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; |
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 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