nodejs / nodejs/node

test_runner: `node --test` silently drops options or args in certain cases

オープン
#64,109 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
JavaScript
スター
122k
フォーク
37.3k
平均マージ
4日 2時間
マージ済み PR(30日)
283

説明

Version

v26.3.0

Subsystem

test_runner

What steps will reproduce the bug?

Either of the following:

node --test no-tests-here "spec/*.test.js"

node --test "spec/*.test.js" --test-reporter tap
What is the expected behavior? Why is that the expected behavior?

In the first case, since positional args are taken as a path or glob for tests to be run, each arg should result in at least one test found and successfully run, else a warning or error should be printed, e.g.:

No tests were found at "no-tests-here".

In the second case, ideally the CLI parsing is changed to allow options to come after positional args (see also #51384 and nodejs/test-runner#13), and --test-reporter tap results in the TAP test reporter being used. If that is not possible, then warnings or errors like the first case:

No tests were found at "--test-reporter".
No tests were found at "tap".

The reason for the warnings or errors is that when a positional arg does not resolve to a single test file, it is most likely a user mistake/typo, or as in the second case, the natural but incorrect assumption that options can be specified at the end.

What do you see instead?

"no-tests-here" in the first case and "--test-reporter tap" in the second are dropped without warning or error.

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、issue にある node --test コマンドで両方のケースを再現し、test_runner CLI の引数処理を追跡してください。完了条件は、位置引数のパスが暗黙に破棄されないことです。一致しないパスでは警告またはエラーが発生し、reporter オプションは位置引数の後でも受け付けられるか、無効であることが明確に報告されます。

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

評価

技術スタック
javascript, node.js
領域
cli, testing-qa
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
58/100

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

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