nodejs / nodejs/node

--experimental-test-coverage empty since 23.5.0

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

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

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

説明

Version

v24.1.0

Platform
Darwin 24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:34:14 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T8122 arm64
Subsystem

test

What steps will reproduce the bug?
import { test } from 'node:test'

console.log(process.versions.node)

test('foo', () => {
  if (false) {
    throw new Error('Failed')
  } else {
    // pass
  }
})
% node --experimental-test-coverage --test i.js    
24.1.0
✔ foo (0.502334ms)
ℹ tests 1
ℹ suites 0
ℹ pass 1
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 57.841208
ℹ start of coverage report
ℹ ----------------------------------------------------------
ℹ file      | line % | branch % | funcs % | uncovered lines
ℹ ----------------------------------------------------------
ℹ ----------------------------------------------------------
ℹ all files | 100.00 |   100.00 |  100.00 | 
ℹ ----------------------------------------------------------
ℹ end of coverage report

Since 23.5.0:

% nvm use 23.5
Now using node v23.5.0 (npm v10.9.2)
% node --experimental-test-coverage --test i.js
23.5.0
✔ foo (0.330042ms)
ℹ tests 1
ℹ suites 0
ℹ pass 1
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 64.134167
ℹ start of coverage report
ℹ -----------------------------------------------------
ℹ file | line % | branch % | funcs % | uncovered lines
ℹ -----------------------------------------------------
ℹ -----------------------------------------------------
ℹ …les | 100.00 |   100.00 |  100.00 | 
ℹ -----------------------------------------------------
ℹ end of coverage report

23.4.0 was fine:

% nvm use 23.4                                 
Now using node v23.4.0 (npm v10.9.2)
% node --experimental-test-coverage --test i.js
23.4.0
✔ foo (0.326084ms)
ℹ tests 1
ℹ suites 0
ℹ pass 1
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 62.499375
ℹ start of coverage report
ℹ -------------------------------------------------------
ℹ file   | line % | branch % | funcs % | uncovered lines
ℹ -------------------------------------------------------
ℹ i.js   |  91.67 |    66.67 |  100.00 | 7
ℹ -------------------------------------------------------
ℹ …files |  91.67 |    66.67 |  100.00 | 
ℹ -------------------------------------------------------
ℹ end of coverage report
How often does it reproduce? Is there a required condition?

Every time

What is the expected behavior? Why is that the expected behavior?

Output on 23.4.0 (see above) was fine
Non-empty coverage report, reporting line 7 in the above example as uncovered

What do you see instead?

Empty coverage

Additional information

No response

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

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

はじめの一歩

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

調査の方向性

提供された i.js の再現用コードから始め、--experimental-test-coverage --test を使用して Node.js 23.4.0、23.5.0、24.1.0 で実行します。テストカバレッジのレポート処理経路を追跡して、後のバージョンでファイルが省略される理由を特定し、その後、レポートが空でなく、7 行目を未カバーとして識別することを確認します。

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

評価

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

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

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