caolan / caolan/nodeunit

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

オープン
#241 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
1.9k
フォーク
359
PR マージ指標
30日以内にマージされた PR はありません

説明

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)
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

runTest(fn, options) を説明しているドキュメントの文を特定し、lib/core.js に示されている runTest のエクスポートシグネチャおよび lib/types.js に示されている options の処理と比較します。実装されている引数と一致するように API の説明と例を更新します。文書化されたシグネチャが正確になれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
documentation
issue の種類
ドキュメント
難易度
1/5
見積もり時間
1時間未満
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。