1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | import type * as Global from './Global';
|
9 | declare type Process = NodeJS.Process;
|
10 | export declare type DoneFn = Global.DoneFn;
|
11 | export declare type BlockFn = Global.BlockFn;
|
12 | export declare type BlockName = Global.BlockName;
|
13 | export declare type BlockMode = void | 'skip' | 'only' | 'todo';
|
14 | export declare type TestMode = BlockMode;
|
15 | export declare type TestName = Global.TestName;
|
16 | export declare type TestFn = Global.TestFn;
|
17 | export declare type HookFn = Global.HookFn;
|
18 | export declare type AsyncFn = TestFn | HookFn;
|
19 | export declare type SharedHookType = 'afterAll' | 'beforeAll';
|
20 | export declare type HookType = SharedHookType | 'afterEach' | 'beforeEach';
|
21 | export declare type TestContext = Global.TestContext;
|
22 | export declare type Exception = any;
|
23 | export declare type FormattedError = string;
|
24 | export declare type Hook = {
|
25 | asyncError: Error;
|
26 | fn: HookFn;
|
27 | type: HookType;
|
28 | parent: DescribeBlock;
|
29 | seenDone: boolean;
|
30 | timeout: number | undefined | null;
|
31 | };
|
32 | export interface EventHandler {
|
33 | (event: AsyncEvent, state: State): void | Promise<void>;
|
34 | (event: SyncEvent, state: State): void;
|
35 | }
|
36 | export declare type Event = SyncEvent | AsyncEvent;
|
37 | interface JestGlobals extends Global.TestFrameworkGlobals {
|
38 | expect: unknown;
|
39 | }
|
40 | export declare type SyncEvent = {
|
41 | asyncError: Error;
|
42 | mode: BlockMode;
|
43 | name: 'start_describe_definition';
|
44 | blockName: BlockName;
|
45 | } | {
|
46 | mode: BlockMode;
|
47 | name: 'finish_describe_definition';
|
48 | blockName: BlockName;
|
49 | } | {
|
50 | asyncError: Error;
|
51 | name: 'add_hook';
|
52 | hookType: HookType;
|
53 | fn: HookFn;
|
54 | timeout: number | undefined;
|
55 | } | {
|
56 | asyncError: Error;
|
57 | name: 'add_test';
|
58 | testName: TestName;
|
59 | fn: TestFn;
|
60 | mode?: TestMode;
|
61 | timeout: number | undefined;
|
62 | } | {
|
63 | name: 'error';
|
64 | error: Exception;
|
65 | };
|
66 | export declare type AsyncEvent = {
|
67 | name: 'setup';
|
68 | testNamePattern?: string;
|
69 | runtimeGlobals: JestGlobals;
|
70 | parentProcess: Process;
|
71 | } | {
|
72 | name: 'include_test_location_in_result';
|
73 | } | {
|
74 | name: 'hook_start';
|
75 | hook: Hook;
|
76 | } | {
|
77 | name: 'hook_success';
|
78 | describeBlock?: DescribeBlock;
|
79 | test?: TestEntry;
|
80 | hook: Hook;
|
81 | } | {
|
82 | name: 'hook_failure';
|
83 | error: string | Exception;
|
84 | describeBlock?: DescribeBlock;
|
85 | test?: TestEntry;
|
86 | hook: Hook;
|
87 | } | {
|
88 | name: 'test_fn_start';
|
89 | test: TestEntry;
|
90 | } | {
|
91 | name: 'test_fn_success';
|
92 | test: TestEntry;
|
93 | } | {
|
94 | name: 'test_fn_failure';
|
95 | error: Exception;
|
96 | test: TestEntry;
|
97 | } | {
|
98 | name: 'test_retry';
|
99 | test: TestEntry;
|
100 | } | {
|
101 | name: 'test_start';
|
102 | test: TestEntry;
|
103 | } | {
|
104 | name: 'test_skip';
|
105 | test: TestEntry;
|
106 | } | {
|
107 | name: 'test_todo';
|
108 | test: TestEntry;
|
109 | } | {
|
110 | name: 'test_done';
|
111 | test: TestEntry;
|
112 | } | {
|
113 | name: 'run_describe_start';
|
114 | describeBlock: DescribeBlock;
|
115 | } | {
|
116 | name: 'run_describe_finish';
|
117 | describeBlock: DescribeBlock;
|
118 | } | {
|
119 | name: 'run_start';
|
120 | } | {
|
121 | name: 'run_finish';
|
122 | } | {
|
123 | name: 'teardown';
|
124 | };
|
125 | export declare type MatcherResults = {
|
126 | actual: unknown;
|
127 | expected: unknown;
|
128 | name: string;
|
129 | pass: boolean;
|
130 | };
|
131 | export declare type TestStatus = 'skip' | 'done' | 'todo';
|
132 | export declare type TestResult = {
|
133 | duration?: number | null;
|
134 | errors: Array<FormattedError>;
|
135 | errorsDetailed: Array<MatcherResults | unknown>;
|
136 | invocations: number;
|
137 | status: TestStatus;
|
138 | location?: {
|
139 | column: number;
|
140 | line: number;
|
141 | } | null;
|
142 | testPath: Array<TestName | BlockName>;
|
143 | };
|
144 | export declare type RunResult = {
|
145 | unhandledErrors: Array<FormattedError>;
|
146 | testResults: TestResults;
|
147 | };
|
148 | export declare type TestResults = Array<TestResult>;
|
149 | export declare type GlobalErrorHandlers = {
|
150 | uncaughtException: Array<(exception: Exception) => void>;
|
151 | unhandledRejection: Array<(exception: Exception, promise: Promise<unknown>) => void>;
|
152 | };
|
153 | export declare type State = {
|
154 | currentDescribeBlock: DescribeBlock;
|
155 | currentlyRunningTest?: TestEntry | null;
|
156 | expand?: boolean;
|
157 | hasFocusedTests: boolean;
|
158 | hasStarted: boolean;
|
159 | originalGlobalErrorHandlers?: GlobalErrorHandlers;
|
160 | parentProcess: Process | null;
|
161 | rootDescribeBlock: DescribeBlock;
|
162 | testNamePattern?: RegExp | null;
|
163 | testTimeout: number;
|
164 | unhandledErrors: Array<Exception>;
|
165 | includeTestLocationInResult: boolean;
|
166 | };
|
167 | export declare type DescribeBlock = {
|
168 | type: 'describeBlock';
|
169 | children: Array<DescribeBlock | TestEntry>;
|
170 | hooks: Array<Hook>;
|
171 | mode: BlockMode;
|
172 | name: BlockName;
|
173 | parent?: DescribeBlock;
|
174 |
|
175 | tests: Array<TestEntry>;
|
176 | };
|
177 | export declare type TestError = Exception | [Exception | undefined, Exception];
|
178 | export declare type TestEntry = {
|
179 | type: 'test';
|
180 | asyncError: Exception;
|
181 | errors: Array<TestError>;
|
182 | fn: TestFn;
|
183 | invocations: number;
|
184 | mode: TestMode;
|
185 | name: TestName;
|
186 | parent: DescribeBlock;
|
187 | startedAt?: number | null;
|
188 | duration?: number | null;
|
189 | seenDone: boolean;
|
190 | status?: TestStatus | null;
|
191 | timeout?: number;
|
192 | };
|
193 | export {};
|