caolan / caolan/nodeunit

Documentation says runTest(fn, options), which appears to be incorrect

Open
#241 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.9k
Forks
359
PR merge metrics
No merged PRs in 30d

Description

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. (/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)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.