nodejs / nodejs/node

test_runner: files without any tests matching `--test-name-pattern` shouldn't be counted or reported

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

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

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

説明

Version

v26.3.0

Subsystem

test_runner

What steps will reproduce the bug?
echo "const test = require('node:test'); test('good test', (t) => { t.assert.equal(1, 1) })" > one.test.js

echo "const test = require('node:test'); test('bad test', (t) => { t.assert.equal(1, 2) })" > two.test.js

node --test --test-name-pattern=good *.test.js 
How often does it reproduce? Is there a required condition?

always

What is the expected behavior? Why is that the expected behavior?
✔ good test (0.963084ms)
ℹ tests 1
ℹ suites 0
ℹ pass 1
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 0.963084ms

The file two.test.js does not contain a single test that matches the --test-name-pattern, so should be skipped entirely, i.e. treated as if it doesn't exist.

What do you see instead?
✔ good test (0.963084ms)
✔ two.test.js (61.52275ms)  <-- file with no matching tests reported (by file name) as passing 
ℹ tests 2                   <-- should be 1 test
ℹ suites 0
ℹ pass 2                    <-- should be 1 pass
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 68.503541     <-- should be 0.963084ms

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

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

はじめの一歩

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

調査の方向性

まず、one.test.js と two.test.js を指定して報告されたコマンドを実行し、次に test_runner の実装と --test-name-pattern の処理に関する既存のテストを調べます。マッチするテストがないファイルが除外され、合計、成功数、所要時間にマッチした成功テストだけが含まれる状態になれば完了です。

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

評価

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

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

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