You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a level parameter to test runner diagnostics #55922
Hey @hpatel292-seneca, thanks for contributing! 😊
Regarding the planned changes: IMHO, it looks okay🚀 I think you could start working on the PR!
Only one thing: atm, the message is a string parameter.
Changing it from a string to an object could require more work and attention, potentially causing breaking changes
I would suggest considering the idea of simply adding a new parameter to the function instead.
Just a trivial reminder: please ensure tests are added to cover this feature.
#handleEvent({ type, data }){switch(type){case'test:fail':
if(data.details?.error?.failureType!==kSubtestsFailed){ArrayPrototypePush(this.#failedTests,data);}returnthis.#handleTestReportEvent(type,data);case'test:pass':
returnthis.#handleTestReportEvent(type,data);case'test:start':
ArrayPrototypeUnshift(this.#stack,{__proto__: null, data, type });break;case'test:stderr':
case'test:stdout':
returndata.message;case'test:diagnostic': // Here I added logicconstdiagnosticColor=reporterColorMap[data.level]||reporterColorMap['test:diagnostic'];return`${diagnosticColor}${indent(data.nesting)}${reporterUnicodeSymbolMap[type]}${data.message}${colors.white}\n`;case'test:coverage':
returngetCoverageReport(indent(data.nesting),data.summary,reporterUnicodeSymbolMap['test:coverage'],colors.blue,true);}}
so my question is I will set the reporter.diagnostic call from test.js like this (level="Error")
if(actual<threshold){harness.success=false;process.exitCode=kGenericUserError;reporter.diagnostic(nesting,loc,`Error: ${NumberPrototypeToFixed(actual,2)}% ${name} coverage does not meet threshold of ${threshold}%.`,'error'// Level is set to error for red color);}
Hi @pmarchini, I am confused, I read Building.md but not sure what option is best for me to build Node. I have windows. Could you please let me know what is best option to build Node locally for Windows.
Hi @pmarchini, I am confused, I read Building.md but not sure what option is best for me to build Node. I have windows. Could you please let me know what is best option to build Node locally for Windows.
@pmarchini How much time do you think the build will take?
Because my building has been running for 1 hour and 10 minutes and still hasn't been completed.
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the
never-staleIssues and PRs exempt from automated stale handling.
label or close this issue if it should be closed. If not, the issue will be automatically closed 6 months after the last non-automated comment.
For more information on how the project manages feature requests, please consult the feature request management document.
Activity
hpatel292-seneca commentedon Nov 20, 2024
Hi @redyetidev @MoLow, I would love to contribute to this.
avivkeller commentedon Nov 20, 2024
Feel free to open a PR
hpatel292-seneca commentedon Nov 22, 2024
Hi @redyetidev, Here is the Summary of Planned changes, please take a look and give feedback
Summary of Planned Changes
To address the problem of coverage threshold errors not being visually distinct, I propose the following enhancements:
Introduce a
levelParameter in Diagnostics:levelparameter (e.g.,debug,info,warn,error) to diagnostic messages.Update Diagnostic Emission:
levelparameter along with the message and location.Delegate Formatting to Reporters:
levelparameter to apply appropriate formatting (e.g., red for errors, yellow for warnings).pmarchini commentedon Nov 22, 2024
Hey @hpatel292-seneca, thanks for contributing! 😊
Regarding the planned changes: IMHO, it looks okay🚀 I think you could start working on the PR!
Only one thing: atm, the message is a string parameter.
Changing it from a string to an object could require more work and attention, potentially causing breaking changes
I would suggest considering the idea of simply adding a new parameter to the function instead.
Just a trivial reminder: please ensure tests are added to cover this feature.
hpatel292-seneca commentedon Nov 22, 2024
Understood. Thanks @pmarchini
hpatel292-seneca commentedon Nov 22, 2024
Hi @pmarchini,
I just wanted to confirm one thing,
so I updated the reporter.diagnostic to accept level parameter like this
Then I updated
#handleEventlike thisAnd I am Updated
reporterColorMaplike thisand color already contain logic for this colors
so my question is I will set the reporter.diagnostic call from test.js like this (level="Error")
right?
pmarchini commentedon Nov 22, 2024
Hey @hpatel292-seneca, I would suggest moving this discussion to a draft PR!
Also, please include at least some tests (even in the draft) to verify the behavior 🚀
hpatel292-seneca commentedon Nov 22, 2024
Hi @pmarchini, I am confused, I read Building.md but not sure what option is best for me to build Node. I have windows. Could you please let me know what is best option to build Node locally for Windows.
Thanks
pmarchini commentedon Nov 22, 2024
I would suggest going with option 3: Boxstarter 🚀
hpatel292-seneca commentedon Nov 22, 2024
@pmarchini How much time do you think the build will take?
Because my building has been running for 1 hour and 10 minutes and still hasn't been completed.
pmarchini commentedon Nov 22, 2024
@hpatel292-seneca it greatly depends on your machine.
On my Windows laptop it takes circa 25 minutes
19 remaining items
test_runner: enhance #handleEvent to handle levels
test_runner: extend reporterColorMap for levels
test_runner: set level for coverage threshold
doc: update 'test:diagnostic' event to include level parameter
test: add test for spec reporter red color output
test: disable no-control-regex for color regex
doc: clarify diagnostic behavior in API docs
test_runner: add level parameter to reporter.diagnostic
test_runner: add level parameter to reporter.diagnostic
test_runner: add level parameter to reporter.diagnostic
github-actions commentedon Jun 11, 2025
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the never-staleIssues and PRs exempt from automated stale handling.
label or close this issue if it should be closed. If not, the issue will be automatically closed 6 months after the last non-automated comment.
For more information on how the project manages feature requests, please consult the feature request management document.
pmarchini commentedon Jun 11, 2025
Resolved by #57923