Type Alias ErrorMatchOptions

ErrorMatchOptions: PartialWithNullable<
    {
        matchConstructor: ErrorConstructor
        | new (...args: any[]) => Error;
        matchMessage: string | RegExp;
    },
>

A type that represents possible error matching patterns. This is used by the .throws and isError, guards in @augment-vir/assert as well as itCases in @augment-vir/test. Each property is optional, and whichever properties are provided will be checked.

import {assert, type ErrorMatchOptions} from '@augment-vir/assert';

// define the options
const matchOptions: ErrorMatchOptions = {
matchConstructor: Error,
matchMessage: 'some error',
};

assert.throws(
() => {
throw new Error('some error');
},
// use the options
matchOptions,
); // this assertion will pass