From 31b3dd28429df7ea7ebc84bdfaf8d9eb9e417b41 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 25 Apr 2019 00:46:40 +0200 Subject: tools: prohibit `assert.doesNotReject()` in Node.js core This makes sure we do not use `assert.doesNotReject()` anywhere in our code base. This is just a simple wrapper that catches the rejection and then rejects it again in case of an error. Thus, it is not useful to do that. The error message for `assert.doesNotThrow()` is also improved. PR-URL: https://github.com/nodejs/node/pull/27402 Reviewed-By: Rich Trott Reviewed-By: Benjamin Gruenbaum Reviewed-By: Beth Griggs Reviewed-By: James M Snell --- doc/api/assert.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/api/assert.md') diff --git a/doc/api/assert.md b/doc/api/assert.md index 9028d21f0d..0a7d35f105 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -454,6 +454,7 @@ function. See [`assert.throws()`][] for more details. Besides the async nature to await the completion behaves identically to [`assert.doesNotThrow()`][]. + ```js (async () => { await assert.doesNotReject( @@ -465,6 +466,7 @@ Besides the async nature to await the completion behaves identically to })(); ``` + ```js assert.doesNotReject(Promise.reject(new TypeError('Wrong value'))) .then(() => { -- cgit v1.2.3