Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 004d26d

Browse filesBrowse files
estrada9166targos
authored andcommitted
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
Copy full SHA for 004d26d

File tree

Expand file treeCollapse file tree

1 file changed

+13
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-0
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-assert.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-assert.js
+13Lines changed: 13 additions & 0 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.