import { toBeError } from "https://deno.land/x/unitest@v1.0.0-beta.82/mod.ts";
Use .toBeError
when checking if a value is Error
object or Error
extended
object.
import {
defineExpect,
not,
test,
toBeError,
} from "https://deno.land/x/unitest@$VERSION/mod.ts";
const expect = defineExpect({
matcherMap: {
toBeError,
},
modifierMap: {
not,
},
});
test("passes when given an error", () => {
expect(Error()).toBeError();
expect({}).not.toBeError();
expect(TypeError()).toBeError(TypeError);
expect(TypeError()).not.toBeError(Error);
expect(TypeError("test with unitest")).toBeError(TypeError, "unitest");
});