Skip to content

--experimental-test-coverage empty since 23.5.0 #58654

Open
@ChALkeR

Description

@ChALkeR

Version

v24.1.0

Platform

Darwin macbook-air.taile5a6b.ts.net 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.test_runnerIssues and PRs related to the test runner subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions