Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_runner: add coverage support with watch mode. #51253

Closed
pulkit-30 opened this issue Dec 21, 2023 · 3 comments · Fixed by #52130
Closed

test_runner: add coverage support with watch mode. #51253

pulkit-30 opened this issue Dec 21, 2023 · 3 comments · Fixed by #52130
Labels
feature request Issues that request new features to be added to Node.js. test_runner Issues and PRs related to the test runner subsystem.

Comments

@pulkit-30
Copy link
Contributor

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

@pulkit-30 pulkit-30 added the feature request Issues that request new features to be added to Node.js. label Dec 21, 2023
@MoLow MoLow added the test_runner Issues and PRs related to the test runner subsystem. label Dec 23, 2023
@MoLow
Copy link
Member

MoLow commented Dec 23, 2023

what would be the trigger/point in time for the coverage report te be calculated?

@pulkit-30
Copy link
Contributor Author

what would be the trigger/point in time for the coverage report te be calculated?

once all tests have completed.

I expected a similar behavior when I ran node --watch --experimental-test-coverage index.test.mjs.

@MoLow
Copy link
Member

MoLow commented Dec 24, 2023

once all tests have completed.

they never complete, thats the point

nodejs-github-bot pushed a commit that referenced this issue Mar 19, 2024
PR-URL: #52130
Fixes: #51253
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
rdw-msft pushed a commit to rdw-msft/node that referenced this issue Mar 26, 2024
PR-URL: nodejs#52130
Fixes: nodejs#51253
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
marco-ippolito pushed a commit that referenced this issue May 2, 2024
PR-URL: #52130
Fixes: #51253
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
marco-ippolito pushed a commit that referenced this issue May 3, 2024
PR-URL: #52130
Fixes: #51253
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. test_runner Issues and PRs related to the test runner subsystem.
Projects
None yet
2 participants