nodeunit
nodeunit copied to clipboard
Documentation says runTest(fn, options), which appears to be incorrect
Unless I am doing something incorrectly, the documentation is incorrect about runTest.
This is what the documentation says:
Nodeunit exports runTest(fn, options), runModule(mod, options) and runFiles(paths, options).
This is what I found when stepping through the code in the debugger:
exports.runTest = function (name, fn, opt, callback) {
// ... elided ...
};
This is what I was doing:
#!/usr/bin/env node
var nodeunit = require('nodeunit'),
reporter = nodeunit.reporters.default;
process.chdir(__dirname + '/..');
var testModule = require(__dirname + '/../test');
nodeunit.runTest(testModule.testBlockSizes, {});
//reporter.run(['test']);
which showed the following errors:
/usr/lib/node_modules/nodeunit/lib/types.js:177
opt[name] = opt[name] || function () {};
^
TypeError: Cannot read property 'moduleStart' of undefined
at optionalCallback (/usr/lib/node_modules/nodeunit/lib/types.js:177:24)
at Object.exports.options (/usr/lib/node_modules/nodeunit/lib/types.js:180:5)
at Object.exports.runTest (/usr/lib/node_modules/nodeunit/lib/core.js:62:25)
at Object.<anonymous> (/home/doug/Documents/Aptana Studio 3 Workspace/simplenode/filetolines/test/standalone.js:8:10)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
I'll probably have a look at the docs tomorrow and see if I can write a correct(ed) version. Keep on scouring the docs! ;)