Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
test_runner: fix typescript coverage#49406
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: fix typescript coverage #49406
Uh oh!
There was an error while loading. Please reload this page.
Conversation
MoLow commented Aug 30, 2023 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot commented Aug 30, 2023
Review requested:
|
lib/internal/test_runner/test.js Outdated
| this.reported=true; | ||
| reporter.plan(nesting,loc,harness.counters.topLevel); | ||
| constcoverage=harness.coverage();// Call this before printing diagnostics, since failure to collect coverage is a diagnostic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cjihrig do we have a way to reproduce an error in coverage collection? I want to snapshot this diagnostic that was missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the easiest thing would be to monkey patch TestCoverage.prototype.summary() or TestCoverage.prototype.cleanup() so that an error is reported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also create a dumb loader like ts-node that instead of reading typescript file it will read plain txt and execute them as JS
2a9c0ed to 53924b2CompareGeoffreyBooth commented Aug 30, 2023
Not sure if this is relevant but in general we’re trying to avoid encouraging users to ever monkey-patch anything; that’s why the Loaders API / module customization hooks exist, and we plan to extend that model to other systems like FS and REPL. We’ve already added |
cjihrig commented Aug 30, 2023
Unless I misunderstood the original question, @MoLow is trying to trigger an error for the purposes of a Node unit test. This is not something end users should ever be doing. |
GeoffreyBooth commented Aug 30, 2023
Excellent, that’s why I wasn’t sure if my comment was relevant. Still though, if/when we need to provide customization abilities for the test runner, like a way to customize output or something, we should consider trying to provide APIs that are somewhat standardized across systems if possible. Maybe that won’t ever be necessary for the test runner since the reporters themselves are so customizable, but I just wanted to bring it up before people started designing new things. |
MoLow commented Aug 31, 2023
@cjihrig you understood me correctly |
53924b2 to 3ed2c63CompareMoLow commented Sep 4, 2023
@nodejs/test_runner I believe this is ready for reviews |
nodejs-github-bot commented Sep 4, 2023
Uh oh!
There was an error while loading. Please reload this page.
3ed2c63 to 8564f65Comparenodejs-github-bot commented Sep 4, 2023
8564f65 to 92edcf7Comparenodejs-github-bot commented Sep 4, 2023
nodejs-github-bot commented Sep 4, 2023
Landed in 47c5152 |
nicoabie commented Sep 4, 2023
Thanks a lot guys! |
PR-URL: #49406Fixes: #49398 Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: nodejs#49406Fixes: nodejs#49398 Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: #49406Fixes: #49398 Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: nodejs/node#49406Fixes: nodejs/node#49398 Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: nodejs/node#49406Fixes: nodejs/node#49398 Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Fixes: #49398
not sure how to test this, any help appreciated