summaryrefslogtreecommitdiff
path: root/doc/api/assert.md
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2017-12-11 05:04:17 -0200
committerRuben Bridgewater <ruben@bridgewater.de>2017-12-19 13:43:31 -0300
commitfe257ac2078676012ed6d188e63e50827fe69d27 (patch)
tree213e8b19ef93524c97332afa418de58ac745a6ea /doc/api/assert.md
parentda5c7d68cdceaa70411ffab6bee16e200a703aa9 (diff)
downloadandroid-node-v8-fe257ac2078676012ed6d188e63e50827fe69d27.tar.gz
android-node-v8-fe257ac2078676012ed6d188e63e50827fe69d27.tar.bz2
android-node-v8-fe257ac2078676012ed6d188e63e50827fe69d27.zip
doc: improve .throws RegExp info
It was not clear why the error name is actually also tested for when using a regular expression. This is now clarified. PR-URL: https://github.com/nodejs/node/pull/17585 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
Diffstat (limited to 'doc/api/assert.md')
-rw-r--r--doc/api/assert.md5
1 files changed, 4 insertions, 1 deletions
diff --git a/doc/api/assert.md b/doc/api/assert.md
index 7ad56accc2..43c7e8e2d4 100644
--- a/doc/api/assert.md
+++ b/doc/api/assert.md
@@ -740,12 +740,15 @@ assert.throws(
Validate error message using [`RegExp`][]:
+Using a regular expression runs `.toString` on the error object, and will
+therefore also include the error name.
+
```js
assert.throws(
() => {
throw new Error('Wrong value');
},
- /value/
+ /^Error: Wrong value$/
);
```