Function throws
- throws(
expect: RegExp | ((error: Error) => boolean),
func_or_promise: () => never,
options?: Annotation | TestOptions,
): ErrorParameters
- expect: RegExp | ((error: Error) => boolean)
A regular expression to match the exception message against
- func_or_promise: () => never
A function to call, or a promise to await
Optionaloptions: Annotation | TestOptionsTest compare options or annotation
Returns Error
The Error object thrown
- expect: RegExp | ((error: Error) => boolean)
- throws(
expect: RegExp | ((error: Error) => boolean),
func_or_promise: Promise<unknown>,
options?: Annotation | TestOptions,
): Promise<Error>Expect a call or promise to throw
Parameters
- expect: RegExp | ((error: Error) => boolean)
A regular expression to match the exception message against
- func_or_promise: Promise<unknown>
A function to call, or a promise to await
Optionaloptions: Annotation | TestOptionsTest compare options or annotation
Returns Promise<Error>
The Error object thrown
- expect: RegExp | ((error: Error) => boolean)
- throws(
expect: RegExp | ((error: Error) => boolean),
func_or_promise: () => Promise<unknown>,
options?: Annotation | TestOptions,
): Promise<Error>Expect a call or promise to throw
Parameters
- expect: RegExp | ((error: Error) => boolean)
A regular expression to match the exception message against
- func_or_promise: () => Promise<unknown>
A function to call, or a promise to await
Optionaloptions: Annotation | TestOptionsTest compare options or annotation
Returns Promise<Error>
The Error object thrown
- expect: RegExp | ((error: Error) => boolean)
- throws(
expect: RegExp | ((error: Error) => boolean),
func_or_promise: () => unknown,
options?: Annotation | TestOptions,
): ErrorExpect a call or promise to throw
Parameters
- expect: RegExp | ((error: Error) => boolean)
A regular expression to match the exception message against
- func_or_promise: () => unknown
A function to call, or a promise to await
Optionaloptions: Annotation | TestOptionsTest compare options or annotation
Returns Error
The Error object thrown
- expect: RegExp | ((error: Error) => boolean)
Expect a call or promise to throw