-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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: fix up N-API error test #20487
test: fix up N-API error test #20487
Conversation
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.
LGTM, I suggest to keep assert.throws
nevertheless.
test/addons-napi/test_error/test.js
Outdated
thrownItem = something; | ||
} | ||
assert(hasThrown); | ||
assert.strictEqual(thrownItem, 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.
It is possible to use assert.throws
when using the following notation:
assert.throws(
() => test_error.throwArbitrary(value),
(err) => {
assert.strictEqual(err, value);
return true;
}
);
986c6ec
to
cc09cb2
Compare
@BridgeAR I updated the check as you suggested. |
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.
LGTM
Replace assert.throws() with an explicit try/catch in order to catch the thrown value and be able to compare it strictly to an expected value. Re: nodejs#20428 (comment)
cc09cb2
to
cfaec6e
Compare
sigh ... linter ... new CI: https://ci.nodejs.org/job/node-test-pull-request/14658/ |
Please +1 if you are fine with fast tracking. |
Landed in 3b60fc2 |
Replace assert.throws() with an explicit try/catch in order to catch the thrown value and be able to compare it strictly to an expected value. Re: #20428 (comment) PR-URL: #20487 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Replace assert.throws() with an explicit try/catch in order to catch the thrown value and be able to compare it strictly to an expected value. Re: #20428 (comment) PR-URL: #20487 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Replace assert.throws() with an explicit try/catch in order to catch the thrown value and be able to compare it strictly to an expected value. Re: #20428 (comment) PR-URL: #20487 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Replace assert.throws() with an explicit try/catch in order to catch the thrown value and be able to compare it strictly to an expected value. Re: #20428 (comment) PR-URL: #20487 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Replace assert.throws() with an explicit try/catch in order to catch
the thrown value and be able to compare it strictly to an expected
value.
Re: #20428 (comment)
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes