UNPKG

3.97 kBTypeScriptView Raw
1import type { Capabilities } from '@wdio/types';
2import WDIOReporter, { TestStats } from '@wdio/reporter';
3import type { SuiteStats, HookStats, RunnerStats } from '@wdio/reporter';
4import { ChalkColors, type SpecReporterOptions, type TestLink, type Symbols, State } from './types.js';
5export default class SpecReporter extends WDIOReporter {
6 private _suiteUids;
7 private _indents;
8 private _suiteIndents;
9 private _orderedSuites;
10 private _consoleOutput;
11 private _suiteIndent;
12 private _preface;
13 private _consoleLogs;
14 private _pendingReasons;
15 private _originalStdoutWrite;
16 private _addConsoleLogs;
17 private _realtimeReporting;
18 private _showPreface;
19 private _suiteName;
20 private _stateCounts;
21 private _symbols;
22 private _chalk;
23 private _onlyFailures;
24 private _sauceLabsSharableLinks;
25 constructor(options: SpecReporterOptions);
26 /**
27 * @param state state of test execution
28 * @param msg the message to print in terminal
29 * @returns colord value based on chalk to print in terminal
30 */
31 setMessageColor(message: string, state?: State): string;
32 onRunnerStart(runner: RunnerStats): void;
33 onSuiteStart(suite: SuiteStats): void;
34 onSuiteEnd(): void;
35 onHookEnd(hook: HookStats): void;
36 onTestStart(): void;
37 onTestPass(testStat: TestStats): void;
38 onTestFail(testStat: TestStats): void;
39 onTestSkip(testStat: TestStats): void;
40 onRunnerEnd(runner: RunnerStats): void;
41 /**
42 * Print the report to the stdout realtime
43 */
44 printCurrentStats(stat: TestStats | HookStats | SuiteStats): void;
45 /**
46 * Print the report to the screen
47 */
48 printReport(runner: RunnerStats): void;
49 /**
50 * get link to saucelabs job
51 */
52 getTestLink({ sessionId, isMultiremote, instanceName, capabilities }: TestLink): string[];
53 /**
54 * Get the header display for the report
55 * @param {Object} runner Runner data
56 * @return {Array} Header data
57 */
58 getHeaderDisplay(runner: RunnerStats): string[];
59 /**
60 * returns everything worth reporting from a suite
61 * @param {Object} suite test suite containing tests and hooks
62 * @return {Object[]} list of events to report
63 */
64 getEventsToReport(suite: SuiteStats): (HookStats | TestStats)[];
65 /**
66 * Get the results from the tests
67 * @param {Array} suites Runner suites
68 * @return {Array} Display output list
69 */
70 getResultDisplay(prefaceString?: string): string[];
71 /**
72 * Get the display for passing, failing and skipped
73 * @param {string} duration Duration string
74 * @return {Array} Count display
75 */
76 getCountDisplay(duration: string): string[];
77 /**
78 * Get display for failed tests, e.g. stack trace
79 * @return {Array} Stack trace output
80 */
81 getFailureDisplay(): string[];
82 /**
83 * Get suites in the order they were called
84 * @return {Array} Ordered suites
85 */
86 getOrderedSuites(): SuiteStats[];
87 /**
88 * Indent a suite based on where how it's nested
89 * @param {string} uid Unique suite key
90 * @return {String} Spaces for indentation
91 */
92 indent(uid: string): string;
93 /**
94 * Get a symbol based on state
95 * @param {string} state State of a test
96 * @return {String} Symbol to display
97 */
98 getSymbol(state?: keyof Symbols): string;
99 /**
100 * Get a color based on a given state
101 * @param {string} state Test state
102 * @return {String} State color
103 */
104 getColor(state?: string): ChalkColors;
105 /**
106 * Get information about the enviroment
107 * @param capability
108 * @param {Boolean} verbose
109 * @param isMultiremote
110 * @return {String} Enviroment string
111 */
112 getEnviromentCombo(capability: Capabilities.ResolvedTestrunnerCapabilities, verbose?: boolean, isMultiremote?: boolean): string;
113}
114//# sourceMappingURL=index.d.ts.map
\No newline at end of file