diff --git a/doc/api/assert.md b/doc/api/assert.md index b3e3a0ed3238ba..456d0a61aecc43 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -1133,6 +1133,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')),