Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/chai/test/bootstrap/index.js>globalErr

BDD / TDD assertion framework for node.js and the browser that can be paired with any testing framework.
Latest
function globalErr
import { globalErr } from "https://deno.land/x/chai@v5.1.2/test/bootstrap/index.js";

Validate that the given function throws an error.

By default, also validate that the thrown error's stack trace doesn't contain Chai implementation frames. Stack trace validation can be disabled by providing a truthy skipStackTest argument.

Optionally validate some additional properties of the error:

If val is a string, validate val equals the error's .message If val is a regex, validate val matches the error's .message If val is an object, validate val's props are included in the error object

Parameters

fn

that's expected to throw an error

val

properties of the expected error

skipStackTest

if truthy, don't validate stack trace