forked from ValentinH/jest-fail-on-console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
45 lines (36 loc) · 1.2 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
declare namespace init {
type InitOptions = {
/**
* This function lets you define a custom error message. The methodName is the method
* that caused the error, bold is a function that lets you bold subsets of your message.
* example: (methodName, bold) => `console.${methodName} is not ${bold('allowed')}`
*/
errorMessage?: (
methodName: 'assert' | 'debug' | 'error' | 'info' | 'log' | 'warn',
bold: (string: string) => string
) => string
/** @default false */
shouldFailOnAssert?: boolean
/** @default false */
shouldFailOnDebug?: boolean
/** @default true */
shouldFailOnError?: boolean
/** @default false */
shouldFailOnInfo?: boolean
/** @default false */
shouldFailOnLog?: boolean
/** @default true */
shouldFailOnWarn?: boolean
/**
* This function is called for every console warn/error.
* If true is returned, the message will not show in the console
* and the test won't fail.
*/
silenceMessage?: (
message: string,
methodName: 'assert' | 'debug' | 'error' | 'info' | 'log' | 'warn'
) => boolean
}
}
declare function init(options?: init.InitOptions): void
export = init