1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | import type {Circus} from '@jest/types';
|
8 | import type {Config} from '@jest/types';
|
9 | import type {ConsoleBuffer} from '@jest/console';
|
10 | import type {CoverageMap} from 'istanbul-lib-coverage';
|
11 | import type {CoverageMapData} from 'istanbul-lib-coverage';
|
12 | import type {IHasteFS} from 'jest-haste-map';
|
13 | import type {IModuleMap} from 'jest-haste-map';
|
14 | import type Resolver from 'jest-resolve';
|
15 | import type {TestResult as TestResult_2} from '@jest/types';
|
16 | import type {TransformTypes} from '@jest/types';
|
17 | import type {V8Coverage} from 'collect-v8-coverage';
|
18 |
|
19 | export declare const addResult: (
|
20 | aggregatedResults: AggregatedResult,
|
21 | testResult: TestResult,
|
22 | ) => void;
|
23 |
|
24 | export declare type AggregatedResult = AggregatedResultWithoutCoverage & {
|
25 | coverageMap?: CoverageMap | null;
|
26 | };
|
27 |
|
28 | declare type AggregatedResultWithoutCoverage = {
|
29 | numFailedTests: number;
|
30 | numFailedTestSuites: number;
|
31 | numPassedTests: number;
|
32 | numPassedTestSuites: number;
|
33 | numPendingTests: number;
|
34 | numTodoTests: number;
|
35 | numPendingTestSuites: number;
|
36 | numRuntimeErrorTestSuites: number;
|
37 | numTotalTests: number;
|
38 | numTotalTestSuites: number;
|
39 | openHandles: Array<Error>;
|
40 | snapshot: SnapshotSummary;
|
41 | startTime: number;
|
42 | success: boolean;
|
43 | testResults: Array<TestResult>;
|
44 | wasInterrupted: boolean;
|
45 | runExecError?: SerializableError;
|
46 | };
|
47 |
|
48 | export declare type AssertionLocation = {
|
49 | fullName: string;
|
50 | path: string;
|
51 | };
|
52 |
|
53 | export declare type AssertionResult = TestResult_2.AssertionResult;
|
54 |
|
55 | export declare const buildFailureTestResult: (
|
56 | testPath: string,
|
57 | err: SerializableError,
|
58 | ) => TestResult;
|
59 |
|
60 | declare type CodeCoverageFormatter = (
|
61 | coverage: CoverageMapData | null | undefined,
|
62 | reporter: CodeCoverageReporter,
|
63 | ) => Record<string, unknown> | null | undefined;
|
64 |
|
65 | declare type CodeCoverageReporter = unknown;
|
66 |
|
67 | export declare const createEmptyTestResult: () => TestResult;
|
68 |
|
69 | export declare type FailedAssertion = {
|
70 | matcherName?: string;
|
71 | message?: string;
|
72 | actual?: unknown;
|
73 | pass?: boolean;
|
74 | passed?: boolean;
|
75 | expected?: unknown;
|
76 | isNot?: boolean;
|
77 | stack?: string;
|
78 | error?: unknown;
|
79 | };
|
80 |
|
81 | declare type FormattedAssertionResult = Pick<
|
82 | AssertionResult,
|
83 | 'ancestorTitles' | 'fullName' | 'location' | 'status' | 'title' | 'duration'
|
84 | > & {
|
85 | failureMessages: AssertionResult['failureMessages'] | null;
|
86 | };
|
87 |
|
88 | declare type FormattedTestResult = {
|
89 | message: string;
|
90 | name: string;
|
91 | summary: string;
|
92 | status: 'failed' | 'passed' | 'skipped' | 'focused';
|
93 | startTime: number;
|
94 | endTime: number;
|
95 | coverage: unknown;
|
96 | assertionResults: Array<FormattedAssertionResult>;
|
97 | };
|
98 |
|
99 | export declare type FormattedTestResults = {
|
100 | coverageMap?: CoverageMap | null | undefined;
|
101 | numFailedTests: number;
|
102 | numFailedTestSuites: number;
|
103 | numPassedTests: number;
|
104 | numPassedTestSuites: number;
|
105 | numPendingTests: number;
|
106 | numPendingTestSuites: number;
|
107 | numRuntimeErrorTestSuites: number;
|
108 | numTotalTests: number;
|
109 | numTotalTestSuites: number;
|
110 | snapshot: SnapshotSummary;
|
111 | startTime: number;
|
112 | success: boolean;
|
113 | testResults: Array<FormattedTestResult>;
|
114 | wasInterrupted: boolean;
|
115 | };
|
116 |
|
117 | export declare function formatTestResults(
|
118 | results: AggregatedResult,
|
119 | codeCoverageFormatter?: CodeCoverageFormatter,
|
120 | reporter?: CodeCoverageReporter,
|
121 | ): FormattedTestResults;
|
122 |
|
123 | export declare const makeEmptyAggregatedTestResult: () => AggregatedResult;
|
124 |
|
125 | export declare interface RuntimeTransformResult
|
126 | extends TransformTypes.TransformResult {
|
127 | wrapperLength: number;
|
128 | }
|
129 |
|
130 | export declare type SerializableError = TestResult_2.SerializableError;
|
131 |
|
132 | export declare type SnapshotSummary = {
|
133 | added: number;
|
134 | didUpdate: boolean;
|
135 | failure: boolean;
|
136 | filesAdded: number;
|
137 | filesRemoved: number;
|
138 | filesRemovedList: Array<string>;
|
139 | filesUnmatched: number;
|
140 | filesUpdated: number;
|
141 | matched: number;
|
142 | total: number;
|
143 | unchecked: number;
|
144 | uncheckedKeysByFile: Array<UncheckedSnapshot>;
|
145 | unmatched: number;
|
146 | updated: number;
|
147 | };
|
148 |
|
149 | export declare type Status = AssertionResult['status'];
|
150 |
|
151 | export declare type Suite = {
|
152 | title: string;
|
153 | suites: Array<Suite>;
|
154 | tests: Array<AssertionResult>;
|
155 | };
|
156 |
|
157 | export declare type Test = {
|
158 | context: TestContext;
|
159 | duration?: number;
|
160 | path: string;
|
161 | };
|
162 |
|
163 | export declare type TestCaseResult = AssertionResult;
|
164 |
|
165 | export declare type TestContext = {
|
166 | config: Config.ProjectConfig;
|
167 | hasteFS: IHasteFS;
|
168 | moduleMap: IModuleMap;
|
169 | resolver: Resolver;
|
170 | };
|
171 |
|
172 | export declare type TestEvents = {
|
173 | 'test-file-start': [Test];
|
174 | 'test-file-success': [Test, TestResult];
|
175 | 'test-file-failure': [Test, SerializableError];
|
176 | 'test-case-start': [string, Circus.TestCaseStartInfo];
|
177 | 'test-case-result': [string, AssertionResult];
|
178 | };
|
179 |
|
180 | export declare type TestFileEvent<
|
181 | T extends keyof TestEvents = keyof TestEvents,
|
182 | > = (eventName: T, args: TestEvents[T]) => unknown;
|
183 |
|
184 | export declare type TestResult = {
|
185 | console?: ConsoleBuffer;
|
186 | coverage?: CoverageMapData;
|
187 | displayName?: Config.DisplayName;
|
188 | failureMessage?: string | null;
|
189 | leaks: boolean;
|
190 | memoryUsage?: number;
|
191 | numFailingTests: number;
|
192 | numPassingTests: number;
|
193 | numPendingTests: number;
|
194 | numTodoTests: number;
|
195 | openHandles: Array<Error>;
|
196 | perfStats: {
|
197 | end: number;
|
198 | runtime: number;
|
199 | slow: boolean;
|
200 | start: number;
|
201 | };
|
202 | skipped: boolean;
|
203 | snapshot: {
|
204 | added: number;
|
205 | fileDeleted: boolean;
|
206 | matched: number;
|
207 | unchecked: number;
|
208 | uncheckedKeys: Array<string>;
|
209 | unmatched: number;
|
210 | updated: number;
|
211 | };
|
212 | testExecError?: SerializableError;
|
213 | testFilePath: string;
|
214 | testResults: Array<AssertionResult>;
|
215 | v8Coverage?: V8CoverageResult;
|
216 | };
|
217 |
|
218 | export declare type TestResultsProcessor = (
|
219 | results: AggregatedResult,
|
220 | ) => AggregatedResult | Promise<AggregatedResult>;
|
221 |
|
222 | declare type UncheckedSnapshot = {
|
223 | filePath: string;
|
224 | keys: Array<string>;
|
225 | };
|
226 |
|
227 | export declare type V8CoverageResult = Array<{
|
228 | codeTransformResult: RuntimeTransformResult | undefined;
|
229 | result: V8Coverage[number];
|
230 | }>;
|
231 |
|
232 | export {};
|