std/testing/asserts.ts

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

Executes a function, expecting it to throw. 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: () => T[src]
optional
ErrorClass: Constructor
[src]
optional
msgIncludes
[src]
optional
msg: string
[src]