nodeunit
nodeunit copied to clipboard
Duplicate test.done() breaks nodeunit internals
test.js (there's no smaller repro than this!):
exports.duplicateDoneBreaksNodeUnit = function(test) {
test.done();
test.done();
};
output:
[1m[32mOK: [39m[22m0 assertions (105ms)
...\project\node_modules\nodeunit\lib\core.js:284
if (group.setUp) {
^
TypeError: Cannot read property 'setUp' of undefined
at wrapGroup (...\project\node_modules\nodeunit\lib\core.js:284:14)
at Object.exports.runSuite (...\project\node_modules\nodeunit\lib\core.js:92:13)
at exports.runSuite (...\project\node_modules\nodeunit\lib\core.js:124:21)
at _concat (...\project\node_modules\nodeunit\deps\async.js:513:13)
at async.forEachSeries.iterate (...\project\node_modules\nodeunit\deps\async.js:123:13)
at async.forEachSeries.iterate (...\project\node_modules\nodeunit\deps\async.js:134:25)
at _concat (...\project\node_modules\nodeunit\deps\async.js:515:17)
at exports.test.test.done (...\project\node_modules\nodeunit\lib\types.js:146:17)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
:+1: Same here
Agreed. It would be nice if nodeunit provided an error message saying that test.done was invoked multiple times or something like that. I started looking around for a setUp function and couldn't find any, it's a very misleading error message.