-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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: coverage for internal util.emitExperimentalWarning #17635
Conversation
|
||
// This test ensures that the emitExperimentalWarning in internal/util emits a | ||
// warning when passed a unsupported feature and that it simply returns when | ||
// passed a supported feature. |
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.
The description isn't correct. The second part "and that it simply returns when passed a supported feature." should say "and that it simply returns when passed the same feature multiple times."
Can this also be moved after the require below.
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.
@apapirovski : Thanks for the feedback. I've updated the PR. Kindly review now.
assert(/is an experimental feature/.test(warning.message)); | ||
}, 2)); | ||
emitExperimentalWarning('feature1'); | ||
emitExperimentalWarning('feature1'); |
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.
Could you add, at the end of the line, // should not warn
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.
@apapirovski : Thanks for the feedback. I've updated the PR. Kindly review now.
|
||
process.on('warning', common.mustCall((warning) => { | ||
assert(/is an experimental feature/.test(warning.message)); | ||
}, 2)); |
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.
Can you please add an empty line in between the process.on('warning')
and emitExperimentalWarning
calls
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.
@maclover7 : Thanks for the feedback. I've updated the PR. Kindly review now.
|
||
emitExperimentalWarning('feature1'); | ||
emitExperimentalWarning('feature1'); | ||
emitExperimentalWarning('feature2'); // should not warn |
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.
Seems like the comment is on the wrong line / the numbers got mixed up?
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.
@BridgeAR : You're right.. my bad. I've fixed it now. Kindly review. Thanks !
const { emitExperimentalWarning } = require('internal/util'); | ||
|
||
// This test ensures that the emitExperimentalWarning in internal/util emits a | ||
// warning when passed a unsupported feature and that it simply returns |
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.
Nit: :%s/a/an ?
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.
@lpinca : Good catch. I've updated it. Thanks !
Landed in 3a53f7c. |
PR-URL: #17635 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: #17635 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: #17635 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: nodejs/node#17635 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: #17635 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: #17635 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
Added missing coverage for method
emitExperimentalWarning
ininternal/utils.js
.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test