UNPKG

1.54 kBTypeScriptView Raw
1import { Predicate, type PredicateOptions } from './predicate.js';
2export declare class ErrorPredicate extends Predicate<Error> {
3 /**
4 @hidden
5 */
6 constructor(options?: PredicateOptions);
7 /**
8 Test an error to have a specific name.
9
10 @param expected - Expected name of the Error.
11 */
12 name(expected: string): this;
13 /**
14 Test an error to have a specific message.
15
16 @param expected - Expected message of the Error.
17 */
18 message(expected: string): this;
19 /**
20 Test the error message to include a specific message.
21
22 @param message - Message that should be included in the error.
23 */
24 messageIncludes(message: string): this;
25 /**
26 Test the error object to have specific keys.
27
28 @param keys - One or more keys which should be part of the error object.
29 */
30 hasKeys(...keys: readonly string[]): this;
31 /**
32 Test an error to be of a specific instance type.
33
34 @param instance - The expected instance type of the error.
35 */
36 instanceOf(instance: Function): this;
37 /**
38 Test an Error to be a TypeError.
39 */
40 get typeError(): this;
41 /**
42 Test an Error to be an EvalError.
43 */
44 get evalError(): this;
45 /**
46 Test an Error to be a RangeError.
47 */
48 get rangeError(): this;
49 /**
50 Test an Error to be a ReferenceError.
51 */
52 get referenceError(): this;
53 /**
54 Test an Error to be a SyntaxError.
55 */
56 get syntaxError(): this;
57 /**
58 Test an Error to be a URIError.
59 */
60 get uriError(): this;
61}