1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | import {AggregatedResult} from '@jest/test-result';
|
10 | import type {AssertionResult} from '@jest/test-result';
|
11 | import type {Circus} from '@jest/types';
|
12 | import {Config} from '@jest/types';
|
13 | import {SnapshotSummary} from '@jest/test-result';
|
14 | import type {Suite} from '@jest/test-result';
|
15 | import {Test} from '@jest/test-result';
|
16 | import {TestCaseResult} from '@jest/test-result';
|
17 | import {TestContext} from '@jest/test-result';
|
18 | import {TestResult} from '@jest/test-result';
|
19 |
|
20 | export {AggregatedResult};
|
21 |
|
22 | export declare class BaseReporter implements Reporter {
|
23 | private _error?;
|
24 | log(message: string): void;
|
25 | onRunStart(
|
26 | _results?: AggregatedResult,
|
27 | _options?: ReporterOnStartOptions,
|
28 | ): void;
|
29 | onTestCaseResult(_test: Test, _testCaseResult: TestCaseResult): void;
|
30 | onTestResult(
|
31 | _test?: Test,
|
32 | _testResult?: TestResult,
|
33 | _results?: AggregatedResult,
|
34 | ): void;
|
35 | onTestStart(_test?: Test): void;
|
36 | onRunComplete(
|
37 | _testContexts?: Set<TestContext>,
|
38 | _aggregatedResults?: AggregatedResult,
|
39 | ): Promise<void> | void;
|
40 | protected _setError(error: Error): void;
|
41 | getLastError(): Error | undefined;
|
42 | }
|
43 |
|
44 | export {Config};
|
45 |
|
46 | export declare class CoverageReporter extends BaseReporter {
|
47 | private readonly _context;
|
48 | private readonly _coverageMap;
|
49 | private readonly _globalConfig;
|
50 | private readonly _sourceMapStore;
|
51 | private readonly _v8CoverageResults;
|
52 | static readonly filename: string;
|
53 | constructor(globalConfig: Config.GlobalConfig, context: ReporterContext);
|
54 | onTestResult(_test: Test, testResult: TestResult): void;
|
55 | onRunComplete(
|
56 | testContexts: Set<TestContext>,
|
57 | aggregatedResults: AggregatedResult,
|
58 | ): Promise<void>;
|
59 | private _addUntestedFiles;
|
60 | private _checkThreshold;
|
61 | private _getCoverageResult;
|
62 | }
|
63 |
|
64 | export declare class DefaultReporter extends BaseReporter {
|
65 | private _clear;
|
66 | private readonly _err;
|
67 | protected _globalConfig: Config.GlobalConfig;
|
68 | private readonly _out;
|
69 | private readonly _status;
|
70 | private readonly _bufferedOutput;
|
71 | static readonly filename: string;
|
72 | constructor(globalConfig: Config.GlobalConfig);
|
73 | protected __wrapStdio(
|
74 | stream: NodeJS.WritableStream | NodeJS.WriteStream,
|
75 | ): void;
|
76 | forceFlushBufferedOutput(): void;
|
77 | protected __clearStatus(): void;
|
78 | protected __printStatus(): void;
|
79 | onRunStart(
|
80 | aggregatedResults: AggregatedResult,
|
81 | options: ReporterOnStartOptions,
|
82 | ): void;
|
83 | onTestStart(test: Test): void;
|
84 | onTestCaseResult(test: Test, testCaseResult: TestCaseResult): void;
|
85 | onRunComplete(): void;
|
86 | onTestResult(
|
87 | test: Test,
|
88 | testResult: TestResult,
|
89 | aggregatedResults: AggregatedResult,
|
90 | ): void;
|
91 | testFinished(
|
92 | config: Config.ProjectConfig,
|
93 | testResult: TestResult,
|
94 | aggregatedResults: AggregatedResult,
|
95 | ): void;
|
96 | printTestFileHeader(
|
97 | testPath: string,
|
98 | config: Config.ProjectConfig,
|
99 | result: TestResult,
|
100 | ): void;
|
101 | printTestFileFailureMessage(
|
102 | _testPath: string,
|
103 | _config: Config.ProjectConfig,
|
104 | result: TestResult,
|
105 | ): void;
|
106 | }
|
107 |
|
108 | declare function formatTestPath(
|
109 | config: Config.GlobalConfig | Config.ProjectConfig,
|
110 | testPath: string,
|
111 | ): string;
|
112 |
|
113 | declare function getResultHeader(
|
114 | result: TestResult,
|
115 | globalConfig: Config.GlobalConfig,
|
116 | projectConfig?: Config.ProjectConfig,
|
117 | ): string;
|
118 |
|
119 | declare function getSnapshotStatus(
|
120 | snapshot: TestResult['snapshot'],
|
121 | afterUpdate: boolean,
|
122 | ): Array<string>;
|
123 |
|
124 | declare function getSnapshotSummary(
|
125 | snapshots: SnapshotSummary,
|
126 | globalConfig: Config.GlobalConfig,
|
127 | updateCommand: string,
|
128 | ): Array<string>;
|
129 |
|
130 | declare function getSummary(
|
131 | aggregatedResults: AggregatedResult,
|
132 | options?: SummaryOptions,
|
133 | ): string;
|
134 |
|
135 | export declare class GitHubActionsReporter extends BaseReporter {
|
136 | #private;
|
137 | static readonly filename: string;
|
138 | private readonly options;
|
139 | constructor(
|
140 | _globalConfig: Config.GlobalConfig,
|
141 | reporterOptions?: {
|
142 | silent?: boolean;
|
143 | },
|
144 | );
|
145 | onTestResult(
|
146 | test: Test,
|
147 | testResult: TestResult,
|
148 | aggregatedResults: AggregatedResult,
|
149 | ): void;
|
150 | private generateAnnotations;
|
151 | private isLastTestSuite;
|
152 | private printFullResult;
|
153 | private arrayEqual;
|
154 | private arrayChild;
|
155 | private getResultTree;
|
156 | private getResultChildren;
|
157 | private printResultTree;
|
158 | private recursivePrintResultTree;
|
159 | private printFailedTestLogs;
|
160 | private startGroup;
|
161 | private endGroup;
|
162 | }
|
163 |
|
164 | export declare class NotifyReporter extends BaseReporter {
|
165 | private readonly _notifier;
|
166 | private readonly _globalConfig;
|
167 | private _context;
|
168 | static readonly filename: string;
|
169 | constructor(globalConfig: Config.GlobalConfig, context: ReporterContext);
|
170 | onRunComplete(testContexts: Set<TestContext>, result: AggregatedResult): void;
|
171 | }
|
172 |
|
173 | declare function printDisplayName(config: Config.ProjectConfig): string;
|
174 |
|
175 | declare function relativePath(
|
176 | config: Config.GlobalConfig | Config.ProjectConfig,
|
177 | testPath: string,
|
178 | ): {
|
179 | basename: string;
|
180 | dirname: string;
|
181 | };
|
182 |
|
183 | export declare interface Reporter {
|
184 | readonly onTestResult?: (
|
185 | test: Test,
|
186 | testResult: TestResult,
|
187 | aggregatedResult: AggregatedResult,
|
188 | ) => Promise<void> | void;
|
189 | readonly onTestFileResult?: (
|
190 | test: Test,
|
191 | testResult: TestResult,
|
192 | aggregatedResult: AggregatedResult,
|
193 | ) => Promise<void> | void;
|
194 | |
195 |
|
196 |
|
197 |
|
198 | readonly onTestCaseStart?: (
|
199 | test: Test,
|
200 | testCaseStartInfo: Circus.TestCaseStartInfo,
|
201 | ) => Promise<void> | void;
|
202 | readonly onTestCaseResult?: (
|
203 | test: Test,
|
204 | testCaseResult: TestCaseResult,
|
205 | ) => Promise<void> | void;
|
206 | readonly onRunStart?: (
|
207 | results: AggregatedResult,
|
208 | options: ReporterOnStartOptions,
|
209 | ) => Promise<void> | void;
|
210 | readonly onTestStart?: (test: Test) => Promise<void> | void;
|
211 | readonly onTestFileStart?: (test: Test) => Promise<void> | void;
|
212 | readonly onRunComplete?: (
|
213 | testContexts: Set<TestContext>,
|
214 | results: AggregatedResult,
|
215 | ) => Promise<void> | void;
|
216 | readonly getLastError?: () => Error | void;
|
217 | }
|
218 |
|
219 | export declare type ReporterContext = {
|
220 | firstRun: boolean;
|
221 | previousSuccess: boolean;
|
222 | changedFiles?: Set<string>;
|
223 | sourcesRelatedToTestsInChangedFiles?: Set<string>;
|
224 | startRun?: (globalConfig: Config.GlobalConfig) => unknown;
|
225 | };
|
226 |
|
227 | export declare type ReporterOnStartOptions = {
|
228 | estimatedTime: number;
|
229 | showStatus: boolean;
|
230 | };
|
231 |
|
232 | export {SnapshotSummary};
|
233 |
|
234 | export declare type SummaryOptions = {
|
235 | currentTestCases?: Array<{
|
236 | test: Test;
|
237 | testCaseResult: TestCaseResult;
|
238 | }>;
|
239 | estimatedTime?: number;
|
240 | roundTime?: boolean;
|
241 | width?: number;
|
242 | showSeed?: boolean;
|
243 | seed?: number;
|
244 | };
|
245 |
|
246 | export declare class SummaryReporter extends BaseReporter {
|
247 | private _estimatedTime;
|
248 | private readonly _globalConfig;
|
249 | private readonly _summaryThreshold;
|
250 | static readonly filename: string;
|
251 | constructor(
|
252 | globalConfig: Config.GlobalConfig,
|
253 | options?: SummaryReporterOptions,
|
254 | );
|
255 | private _validateOptions;
|
256 | private _write;
|
257 | onRunStart(
|
258 | aggregatedResults: AggregatedResult,
|
259 | options: ReporterOnStartOptions,
|
260 | ): void;
|
261 | onRunComplete(
|
262 | testContexts: Set<TestContext>,
|
263 | aggregatedResults: AggregatedResult,
|
264 | ): void;
|
265 | private _printSnapshotSummary;
|
266 | private _printSummary;
|
267 | private _getTestSummary;
|
268 | }
|
269 |
|
270 | export declare type SummaryReporterOptions = {
|
271 | summaryThreshold?: number;
|
272 | };
|
273 |
|
274 | export {Test};
|
275 |
|
276 | export {TestCaseResult};
|
277 |
|
278 | export {TestContext};
|
279 |
|
280 | export {TestResult};
|
281 |
|
282 | declare function trimAndFormatPath(
|
283 | pad: number,
|
284 | config: Config.ProjectConfig | Config.GlobalConfig,
|
285 | testPath: string,
|
286 | columns: number,
|
287 | ): string;
|
288 |
|
289 | export declare const utils: {
|
290 | formatTestPath: typeof formatTestPath;
|
291 | getResultHeader: typeof getResultHeader;
|
292 | getSnapshotStatus: typeof getSnapshotStatus;
|
293 | getSnapshotSummary: typeof getSnapshotSummary;
|
294 | getSummary: typeof getSummary;
|
295 | printDisplayName: typeof printDisplayName;
|
296 | relativePath: typeof relativePath;
|
297 | trimAndFormatPath: typeof trimAndFormatPath;
|
298 | };
|
299 |
|
300 | export declare class VerboseReporter extends DefaultReporter {
|
301 | protected _globalConfig: Config.GlobalConfig;
|
302 | static readonly filename: string;
|
303 | constructor(globalConfig: Config.GlobalConfig);
|
304 | protected __wrapStdio(
|
305 | stream: NodeJS.WritableStream | NodeJS.WriteStream,
|
306 | ): void;
|
307 | static filterTestResults(
|
308 | testResults: Array<AssertionResult>,
|
309 | ): Array<AssertionResult>;
|
310 | static groupTestsBySuites(testResults: Array<AssertionResult>): Suite;
|
311 | onTestResult(
|
312 | test: Test,
|
313 | result: TestResult,
|
314 | aggregatedResults: AggregatedResult,
|
315 | ): void;
|
316 | private _logTestResults;
|
317 | private _logSuite;
|
318 | private _getIcon;
|
319 | private _logTest;
|
320 | private _logTests;
|
321 | private _logTodoOrPendingTest;
|
322 | private _logLine;
|
323 | }
|
324 |
|
325 | export {};
|