Skip to content

Commit 9516aa1

Browse files
committed
test: add common.mustCall() to NAPI exception test
Use `common.mustCall()` to confirm that function is invoked. PR-URL: #12959 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 84fc069 commit 9516aa1

File tree

1 file changed

+2
-4
lines changed
  • test/addons-napi/test_exception

1 file changed

+2
-4
lines changed

test/addons-napi/test_exception/test.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ function throwTheError() {
99
}
1010
let caughtError;
1111

12-
const throwNoError = common.noop;
13-
1412
// Test that the native side successfully captures the exception
1513
let returnedError = test_exception.returnException(throwTheError);
1614
assert.strictEqual(theError, returnedError,
@@ -34,13 +32,13 @@ assert.strictEqual(test_exception.wasPending(), true,
3432
' when it was allowed through');
3533

3634
// Test that the native side does not capture a non-existing exception
37-
returnedError = test_exception.returnException(throwNoError);
35+
returnedError = test_exception.returnException(common.mustCall());
3836
assert.strictEqual(undefined, returnedError,
3937
'Returned error is undefined when no exception is thrown');
4038

4139
// Test that no exception appears that was not thrown by us
4240
try {
43-
test_exception.allowException(throwNoError);
41+
test_exception.allowException(common.mustCall());
4442
} catch (anError) {
4543
caughtError = anError;
4644
}

0 commit comments

Comments
 (0)