Skip to content

Commit 937afcc

Browse files
estrada9166targos
authored andcommittedJul 2, 2019
test: add test to doesNotThrow; validate if actual with regex
Refs: https://coverage.nodejs.org/coverage-1a4f27ae21698d0c/lib/assert.js.html#L736 PR-URL: #28355 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 004d26d commit 937afcc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
 

‎test/parallel/test-assert.js

+11
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,17 @@ assert.throws(
178178
}
179179
);
180180

181+
assert.throws(
182+
() => a.doesNotThrow(() => thrower(Error), /\[[a-z]{6}\s[A-z]{6}\]/g, 'user message'),
183+
{
184+
name: 'AssertionError',
185+
code: 'ERR_ASSERTION',
186+
operator: 'doesNotThrow',
187+
message: 'Got unwanted exception: user message\n' +
188+
'Actual message: "[object Object]"'
189+
}
190+
);
191+
181192
// Make sure that validating using constructor really works.
182193
{
183194
let threw = false;

0 commit comments

Comments
 (0)