std/testing/asserts.ts

Deno standard library
Go to Latest
function assertThrowsAsync
import { assertThrowsAsync } from "https://deno.land/std@0.102.0/testing/asserts.ts?s=assertThrowsAsync";

Executes a function which returns a promise, expecting it to throw or reject. If it does not, then it throws. An error class and a string that should be included in the error message can also be asserted.

Type Parameters

optional
T = void
[src]

Parameters

fn: () => Promise<T>[src]
optional
ErrorClass: Constructor
[src]
optional
msgIncludes
[src]
optional
msg: string
[src]

Returns

Promise<Error>[src]