Skip to content

test_runner: add coverage support with watch mode. #51253

Closed
@pulkit-30

Description

@pulkit-30

What is the problem this feature will solve?

Currently, we can't get coverage report along with watch flag.

code:

import test from "node:test";

test("foo", () => {});

run cmd ./node/node --test --watch --experimental-test-coverage

output:

pulkitgupta@Pulkits-MacBook-Air jest-2 % ../node/node --test --watch --experimental-test-coverage
✔ foo (0.867791ms)
^C%                                                                                                                                                       
pulkitgupta@Pulkits-MacBook-Air jest-2 % 

no coverage report.

What is the feature you are proposing to solve the problem?

To show test coverage with watch mode, (something similar what jest does).

output:

pulkitgupta@Pulkits-MacBook-Air jest-2 % ../node/node --test --watch --experimental-test-coverage  
✔ foo (1.044042ms)
ℹ start of coverage report
ℹ ---------------------------------------------------------------
ℹ file           | line % | branch % | funcs % | uncovered lines
ℹ ---------------------------------------------------------------
ℹ index.test.mjs | 100.00 |   100.00 |  100.00 | 
ℹ ---------------------------------------------------------------
ℹ all files      | 100.00 |   100.00 |  100.00 |
ℹ ---------------------------------------------------------------
ℹ end of coverage report
^C%  

What alternatives have you considered?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.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