function default.doesNotReject
Usage in Deno
```typescript import mod from "node:node__assert.d.ts"; ```
doesNotReject(block: (() => Promise<unknown>) | Promise<unknown>,message?: string | Error,): Promise<void>
Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
calls the function and awaits the returned promise to complete. It will then
check that the promise is not rejected.
If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If
the function does not return a promise, `assert.doesNotReject()` will return a
rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v22.x/api/errors.html#err_invalid_return_value) error. In both cases
the error handler is skipped.
Using `assert.doesNotReject()` is actually not useful because there is little
benefit in catching a rejection and then rejecting it again. Instead, consider
adding a comment next to the specific code path that should not reject and keep
error messages as expressive as possible.
If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
[`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation
function. See [throws](../.././node__assert.d.ts/~/default.throws) for more details.
Besides the async nature to await the completion behaves identically to [doesNotThrow](../.././node__assert.d.ts/~/default.doesNotThrow).
```js
import assert from 'node:assert/strict';
await assert.doesNotReject(
async () => {
throw new TypeError('Wrong value');
},
SyntaxError,
);
```
```js
import assert from 'node:assert/strict';
assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))
.then(() => {
// ...
});
```
Promise<void>
doesNotReject(): Promise<void>
error: AssertPredicate
Promise<void>