-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: replaces assert.throws() with common.expectsError() #22689
Conversation
replaces assert.throws() with common.expectsError() to check error code and error type in parallel/test-buffer-alloc.js
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.
There is no need to use common.expectsError()
to do this. assert.throws()
is also able to do that. Therefore the message is a bit off. I suggest to rephrase to:
test: check for error codes in test-buffer-alloc.js
Otherwise LGTM
@BridgeAR The reason to use Once 10.x is the oldest supported version, we can likely get rid of |
assert.throws(() => b.write('', 2048), RangeError); | ||
common.expectsError( | ||
() => b.write('', 2048), | ||
{ |
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: Since this error object is used multiple times in the test, it can be stored in a const.
Resume build: https://ci.nodejs.org/job/node-test-pull-request/17084/ |
I remember we used to use |
@refack |
replaces assert.throws() with common.expectsError() to check error code and error type in parallel/test-buffer-alloc.js PR-URL: nodejs#22689 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Landed in 9782ce2. Thanks for the contribution! 🎉 (If you're interested in other possible contributions to Node.js but don't have a good idea of where to start looking, some ideas are posted at https://www.nodetodo.org/next-steps/.) |
replaces assert.throws() with common.expectsError() to check error code and error type in parallel/test-buffer-alloc.js PR-URL: #22689 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
replaces assert.throws() with common.expectsError() to check error code
and error type in parallel/test-buffer-alloc.js
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes