Documentation says runTest(fn, options), which appears to be incorrect
- Vorherrschende Sprache
- JavaScript
- Sterne
- 1.9k
- Forks
- 359
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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)
```
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Finde den Dokumentationssatz, der runTest(fn, options) beschreibt, und vergleiche ihn anschließend mit der in lib/core.js gezeigten runTest-Exportsignatur und der in lib/types.js gezeigten Behandlung von options. Aktualisiere die API-Beschreibung und das Beispiel so, dass sie mit den implementierten Argumenten übereinstimmen; abgeschlossen ist die Aufgabe, wenn die dokumentierte Signatur korrekt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 1/5
- Geschätzter Aufwand
- Unter einer Stunde
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 45/100