Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 004d26d

Browse files
estrada9166targos
authored andcommittedJul 2, 2019
test: add tests to assert.ok and improve coverage
Refs: https://coverage.nodejs.org/coverage-1a4f27ae21698d0c/lib/assert.js.html#L364 PR-URL: #28355 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent fd4d1e2 commit 004d26d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎test/parallel/test-assert.js

+13
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ assert.ok(a.AssertionError.prototype instanceof Error,
4444
assert.throws(() => a(false), a.AssertionError, 'ok(false)');
4545
assert.throws(() => a.ok(false), a.AssertionError, 'ok(false)');
4646

47+
// Throw message if the message is instanceof Error.
48+
{
49+
let threw = false;
50+
try {
51+
assert.ok(false, new Error('ok(false)'));
52+
} catch (e) {
53+
threw = true;
54+
assert.ok(e instanceof Error);
55+
}
56+
assert.ok(threw, 'Error: ok(false)');
57+
}
58+
59+
4760
a(true);
4861
a('test', 'ok(\'test\')');
4962
a.ok(true);

0 commit comments

Comments
 (0)
Please sign in to comment.