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