test: replaces assert.throws() with common.expectsError()#22689
test: replaces assert.throws() with common.expectsError()#22689saudkhanzada wants to merge 1 commit intonodejs:masterfrom
Conversation
replaces assert.throws() with common.expectsError() to check error code and error type in parallel/test-buffer-alloc.js
BridgeAR
left a comment
There was a problem hiding this comment.
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.
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 <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
|
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 <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
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