Skip to content

Commit

Permalink
test: improve assert messages in napi exception test
Browse files Browse the repository at this point in the history
Include unexpected value in assertion messages.

Backport-PR-URL: #19447
PR-URL: #16820
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
PaulBlanche authored and MylesBorins committed Apr 16, 2018
1 parent c14207c commit d4c04e0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/addons-napi/test_exception/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ assert.strictEqual(test_exception.wasPending(), true,
// Test that the native side does not capture a non-existing exception
returnedError = test_exception.returnException(common.mustCall());
assert.strictEqual(undefined, returnedError,
'Returned error is undefined when no exception is thrown');
'Returned error should be undefined when no exception is' +
` thrown, but ${returnedError} was passed`);

// Test that no exception appears that was not thrown by us
try {
Expand All @@ -42,7 +43,8 @@ try {
caughtError = anError;
}
assert.strictEqual(undefined, caughtError,
'No exception originated on the native side');
'No exception originated on the native side, but' +
` ${caughtError} was passed`);

// Test that the exception state remains clear when no exception is thrown
assert.strictEqual(test_exception.wasPending(), false,
Expand Down

0 comments on commit d4c04e0

Please sign in to comment.