Skip to content

Commit

Permalink
test: add test to doesNotThrow; validate if actual with regex
Browse files Browse the repository at this point in the history
Refs: https://coverage.nodejs.org/coverage-1a4f27ae21698d0c/lib/assert.js.html#L736

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>
  • Loading branch information
estrada9166 authored and targos committed Jul 2, 2019
1 parent 004d26d commit 937afcc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/parallel/test-assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ assert.throws(
}
);

assert.throws(
() => a.doesNotThrow(() => thrower(Error), /\[[a-z]{6}\s[A-z]{6}\]/g, 'user message'),
{
name: 'AssertionError',
code: 'ERR_ASSERTION',
operator: 'doesNotThrow',
message: 'Got unwanted exception: user message\n' +
'Actual message: "[object Object]"'
}
);

// Make sure that validating using constructor really works.
{
let threw = false;
Expand Down

0 comments on commit 937afcc

Please sign in to comment.