caolan / caolan/nodeunit

Run object instead of runFiles?

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

説明

In nodeunit, whenever you call

nodeunit.reporters["default"].run(["a","b"]);

it will always, eventually, require("a") as a test and run it, then require("b") and then run it.

What if you want to load files on your own, or even define tests in memory, never saving to a file? As an example, I could see loading a file, doing some manipulation, and only then passing it through to nodeunit.

In this scenario, the two run() calls below would be equivalent:

var a = require("a");
nodeunit.reporters["default"].run(["a"]);
nodeunit.reporters["default"].runModule(a);

But the second option gives me the ability to do:

var a = require("a");
a.doSomeMod();
nodeunit.reporters["default"].runModule(a);

Even better, you don't need runModule. All you need is for run() to check each option in the array; if it is a string, require() it as a file, else just use it as is.

Whole change set could probably be done in nodeunit.js ll 61-81.

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

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

調査の方向性

nodeunit.js の 61~81 行付近から始め、デフォルト reporter の run メソッドが入力配列をどのように処理し、テストファイルを require しているかを調べてください。要求されているファイルベースのモジュールとメモリ内モジュールのケースを比較し、両方の形式が正しく実行され、既存の動作が維持されていることを確認してください。

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

評価

技術スタック
javascript, node.js
領域
backend, testing-qa
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

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

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