-
Notifications
You must be signed in to change notification settings - Fork 30k
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: increase util.callbackify() coverage #13705
Conversation
|
||
{ | ||
// Verify that non-function inputs throw. | ||
['foo', null, undefined, false, 0, {}, Symbol(), []].forEach((value) => { |
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.
Tiny nit: could use values.filter(v => typeof v !== 'function')
}, common.expectsError({ | ||
code: 'ERR_INVALID_ARG_TYPE', | ||
type: TypeError, | ||
message: 'The "last argument" argument must be of type function' |
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.
this output is a tiny bit unfortunate 🤷♂️ I should have covered this
This commit adds coverage for util.callbackify() type checking. PR-URL: nodejs#13705
Ref: #12712 |
|
||
{ | ||
async function asyncFn() { | ||
return await Promise.resolve(42); |
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: the return itself is already sufficient as the return value is implicitly wrapped in a promise. Therefore the await
can be removed.
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.
Indeed, but that's the way to other tests are written (e.g. https://github.com/nodejs/node/blob/master/test/parallel/test-util-callbackify.js#L31)
The rationale was to make them actually async
in timing, not just in signature.
@cjihrig I would like to bundle this with the other |
CI: https://ci.nodejs.org/job/node-test-pull-request/8735/ EDIT: Linter failed, so CI again: https://ci.nodejs.org/job/node-test-pull-request/8740/ |
This commit adds coverage for util.callbackify() type checking. PR-URL: nodejs#13705 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit adds coverage for util.callbackify() type checking. PR-URL: #13705 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit adds coverage for util.callbackify() type checking. PR-URL: #13705 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit adds coverage for util.callbackify() type checking. PR-URL: #13705 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit adds coverage for util.callbackify() type checking. PR-URL: #13705 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit adds coverage for util.callbackify() type checking. PR-URL: #13705 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit adds coverage for util.callbackify() type checking. PR-URL: #13705 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
setting as don't land, will likely need to be revisited if we decide to backport |
This commit adds coverage for
util.callbackify()
type checking.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test