diff --git a/doc/api/assert.md b/doc/api/assert.md index 5c4a7986ed71d7..8bfe2757821a29 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -1111,6 +1111,21 @@ if the `asyncFn` fails to reject. })(); ``` +```js +(async () => { + await assert.rejects( + async () => { + throw new TypeError('Wrong value'); + }, + (err) => { + assert.strictEqual(err.name, 'TypeError'); + assert.strictEqual(err.message, 'Wrong value'); + return true; + } + ); +})(); +``` + ```js assert.rejects( Promise.reject(new Error('Wrong value')),