summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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$/
);
```