| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
replaces assert.throws() with common.expectsError() to check error code and error type in parallel/test-buffer-alloc.js
Sorry, something went wrong.
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
Sorry, something went wrong.
@BridgeAR The reason to use common.expectsError() is so that it can be cherry-picked into the 8.x-staging branch rather than requiring a backport. Once 10.x is the oldest supported version, we can likely get rid of common.expectsError() in favor of assert.throws(). (We'll need to refactor cases where common.expectsError() returns a function, but it should be do-able.) |
Sorry, something went wrong.
| 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.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
|
Resume build: https://ci.nodejs.org/job/node-test-pull-request/17084/ |
Sorry, something went wrong.
I remember we used to use common.expectsError for checking NodeErrors that have an error code, while assert.throws was the legacy usage. And we used that distinction to track where we still throw "old" errors. |
Sorry, something went wrong.
|
@refack assert.throws() became significantly more powerful in the meanwhile. It now behaves very similar to common.expectsError(). But @Trott is correct that these changes were not yet backported to 8 and it's easier to backport everything with the current notation until those features landed in 8 as well. |
Sorry, something went wrong.
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/.) |
Sorry, something went wrong.
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>
| Back | FazBrowse Home | New Git URL |
replaces assert.throws() with common.expectsError() to check error code
and error type in parallel/test-buffer-alloc.js
Checklist