-
Notifications
You must be signed in to change notification settings - Fork 21
/
index.d.ts
63 lines (51 loc) · 1.85 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
declare namespace init {
type ConsoleMethodName = 'assert' | 'debug' | 'error' | 'info' | 'log' | 'warn'
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: ConsoleMethodName, 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 methods.
* If true is returned, the message will not show in the console
* and the test won't fail.
*/
silenceMessage?: (
message: string,
methodName: ConsoleMethodName,
context: { group: string; groups: string[] }
) => boolean
/**
* This function is called for every test setup and teardown to determine if the test should
* skip console checks from this package or not.
*/
skipTest?: (args: { testName: string; testPath: string }) => boolean
/**
* This function is called for every console methods.
* If true is returned, the message will not cause the tests to fail and will be logged to the console.
*/
allowMessage?: (
message: string,
methodName: ConsoleMethodName,
context: { group: string; groups: string[] }
) => boolean
/** @default false */
shouldPrintMessage?: boolean
}
}
declare function init(options?: init.InitOptions): void
export = init