Unverified Commit e33f773d authored by Ruben Bridgewater's avatar Ruben Bridgewater
Browse files

assert: implement `assert.match()` and `assert.doesNotMatch()`

This adds a new functionality to the assertion module: a dedicated
check for regular expressions. So far it's possible to use
`assert.ok(regexp.test(string))`. This is not ideal though when it
comes to the error message, since it's not possible to know how
either of the input values look like. It's just known that the
assertion failed.
This allows to pass through the regular expression and the input
string. The string is then matched against the regular expression
and reports a expressive error message in case of a failure.

PR-URL: https://github.com/nodejs/node/pull/30929


Reviewed-By: default avatarMichaël Zasso <targos@protonmail.com>
Reviewed-By: default avatarRich Trott <rtrott@gmail.com>
Reviewed-By: default avatarStephen Belanger <admin@stephenbelanger.com>
parent a1d307fc
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment