保誠-保戶業務員媒合平台
HelenHuang
2022-06-09 9bdb95c9e34cef640534e5e5a1e2225a80442000
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/**
 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
/// <reference types="node" />
import type * as Global from './Global';
declare type Process = NodeJS.Process;
export declare type DoneFn = Global.DoneFn;
export declare type BlockFn = Global.BlockFn;
export declare type BlockName = Global.BlockName;
export declare type BlockMode = void | 'skip' | 'only' | 'todo';
export declare type TestMode = BlockMode;
export declare type TestName = Global.TestName;
export declare type TestFn = Global.TestFn;
export declare type HookFn = Global.HookFn;
export declare type AsyncFn = TestFn | HookFn;
export declare type SharedHookType = 'afterAll' | 'beforeAll';
export declare type HookType = SharedHookType | 'afterEach' | 'beforeEach';
export declare type TestContext = Global.TestContext;
export declare type Exception = any;
export declare type FormattedError = string;
export declare type Hook = {
    asyncError: Error;
    fn: HookFn;
    type: HookType;
    parent: DescribeBlock;
    seenDone: boolean;
    timeout: number | undefined | null;
};
export interface EventHandler {
    (event: AsyncEvent, state: State): void | Promise<void>;
    (event: SyncEvent, state: State): void;
}
export declare type Event = SyncEvent | AsyncEvent;
interface JestGlobals extends Global.TestFrameworkGlobals {
    expect: unknown;
}
export declare type SyncEvent = {
    asyncError: Error;
    mode: BlockMode;
    name: 'start_describe_definition';
    blockName: BlockName;
} | {
    mode: BlockMode;
    name: 'finish_describe_definition';
    blockName: BlockName;
} | {
    asyncError: Error;
    name: 'add_hook';
    hookType: HookType;
    fn: HookFn;
    timeout: number | undefined;
} | {
    asyncError: Error;
    name: 'add_test';
    testName: TestName;
    fn: TestFn;
    mode?: TestMode;
    timeout: number | undefined;
} | {
    name: 'error';
    error: Exception;
};
export declare type AsyncEvent = {
    name: 'setup';
    testNamePattern?: string;
    runtimeGlobals: JestGlobals;
    parentProcess: Process;
} | {
    name: 'include_test_location_in_result';
} | {
    name: 'hook_start';
    hook: Hook;
} | {
    name: 'hook_success';
    describeBlock?: DescribeBlock;
    test?: TestEntry;
    hook: Hook;
} | {
    name: 'hook_failure';
    error: string | Exception;
    describeBlock?: DescribeBlock;
    test?: TestEntry;
    hook: Hook;
} | {
    name: 'test_fn_start';
    test: TestEntry;
} | {
    name: 'test_fn_success';
    test: TestEntry;
} | {
    name: 'test_fn_failure';
    error: Exception;
    test: TestEntry;
} | {
    name: 'test_retry';
    test: TestEntry;
} | {
    name: 'test_start';
    test: TestEntry;
} | {
    name: 'test_skip';
    test: TestEntry;
} | {
    name: 'test_todo';
    test: TestEntry;
} | {
    name: 'test_done';
    test: TestEntry;
} | {
    name: 'run_describe_start';
    describeBlock: DescribeBlock;
} | {
    name: 'run_describe_finish';
    describeBlock: DescribeBlock;
} | {
    name: 'run_start';
} | {
    name: 'run_finish';
} | {
    name: 'teardown';
};
export declare type MatcherResults = {
    actual: unknown;
    expected: unknown;
    name: string;
    pass: boolean;
};
export declare type TestStatus = 'skip' | 'done' | 'todo';
export declare type TestResult = {
    duration?: number | null;
    errors: Array<FormattedError>;
    errorsDetailed: Array<MatcherResults | unknown>;
    invocations: number;
    status: TestStatus;
    location?: {
        column: number;
        line: number;
    } | null;
    testPath: Array<TestName | BlockName>;
};
export declare type RunResult = {
    unhandledErrors: Array<FormattedError>;
    testResults: TestResults;
};
export declare type TestResults = Array<TestResult>;
export declare type GlobalErrorHandlers = {
    uncaughtException: Array<(exception: Exception) => void>;
    unhandledRejection: Array<(exception: Exception, promise: Promise<unknown>) => void>;
};
export declare type State = {
    currentDescribeBlock: DescribeBlock;
    currentlyRunningTest?: TestEntry | null;
    expand?: boolean;
    hasFocusedTests: boolean;
    hasStarted: boolean;
    originalGlobalErrorHandlers?: GlobalErrorHandlers;
    parentProcess: Process | null;
    rootDescribeBlock: DescribeBlock;
    testNamePattern?: RegExp | null;
    testTimeout: number;
    unhandledErrors: Array<Exception>;
    includeTestLocationInResult: boolean;
};
export declare type DescribeBlock = {
    type: 'describeBlock';
    children: Array<DescribeBlock | TestEntry>;
    hooks: Array<Hook>;
    mode: BlockMode;
    name: BlockName;
    parent?: DescribeBlock;
    /** @deprecated Please get from `children` array instead */
    tests: Array<TestEntry>;
};
export declare type TestError = Exception | [Exception | undefined, Exception];
export declare type TestEntry = {
    type: 'test';
    asyncError: Exception;
    errors: Array<TestError>;
    fn: TestFn;
    invocations: number;
    mode: TestMode;
    name: TestName;
    parent: DescribeBlock;
    startedAt?: number | null;
    duration?: number | null;
    seenDone: boolean;
    status?: TestStatus | null;
    timeout?: number;
};
export {};