1 |
|
2 | import { EventEmitter } from 'node:events';
|
3 | import type { Options, Workers } from '@wdio/types';
|
4 | import { HookError } from './utils.js';
|
5 | interface TestError {
|
6 | type: string;
|
7 | message: string;
|
8 | stack?: string;
|
9 | }
|
10 | interface CLIInterfaceEvent {
|
11 | origin?: string;
|
12 | name: string;
|
13 | cid?: string;
|
14 | fullTitle?: string;
|
15 | content?: any;
|
16 | params?: any;
|
17 | error?: TestError;
|
18 | }
|
19 | export default class WDIOCLInterface extends EventEmitter {
|
20 | #private;
|
21 | private _config;
|
22 | totalWorkerCnt: number;
|
23 | private _isWatchMode;
|
24 | hasAnsiSupport: boolean;
|
25 | result: {
|
26 | finished: number;
|
27 | passed: number;
|
28 | retries: number;
|
29 | failed: number;
|
30 | };
|
31 | private _jobs;
|
32 | private _specFileRetries;
|
33 | private _specFileRetriesDelay;
|
34 | private _skippedSpecs;
|
35 | private _inDebugMode;
|
36 | private _start;
|
37 | private _messages;
|
38 | constructor(_config: Options.Testrunner, totalWorkerCnt: number, _isWatchMode?: boolean);
|
39 | setup(): void;
|
40 | onStart(): void;
|
41 | onSpecRunning(rid: string): void;
|
42 | onSpecRetry(rid: string, job?: Workers.Job, retries?: number): void;
|
43 | onSpecPass(rid: string, job?: Workers.Job, retries?: number): void;
|
44 | onSpecFailure(rid: string, job?: Workers.Job, retries?: number): void;
|
45 | onSpecSkip(rid: string, job?: Workers.Job): void;
|
46 | onJobComplete(cid: string, job?: Workers.Job, retries?: number, message?: string, _logger?: Function): any;
|
47 | onTestError(payload: CLIInterfaceEvent): any[];
|
48 | getFilenames(specs?: string[]): string;
|
49 | /**
|
50 | * add job to interface
|
51 | */
|
52 | addJob({ cid, caps, specs, hasTests }: Workers.Job & {
|
53 | cid: string;
|
54 | }): void;
|
55 | /**
|
56 | * clear job from interface
|
57 | */
|
58 | clearJob({ cid, passed, retries }: {
|
59 | cid: string;
|
60 | passed: boolean;
|
61 | retries: number;
|
62 | }): void;
|
63 | /**
|
64 | * for testing purposes call console log in a static method
|
65 | */
|
66 | log(...args: any[]): any[];
|
67 | logHookError(error: Error | HookError): any[];
|
68 | /**
|
69 | * event handler that is triggered when runner sends up events
|
70 | */
|
71 | onMessage(event: CLIInterfaceEvent): boolean | void | any[];
|
72 | sigintTrigger(): false | any[];
|
73 | printReporters(): void;
|
74 | printSummary(): any[];
|
75 | finalise(): void;
|
76 | }
|
77 | export {};
|
78 |
|
\ | No newline at end of file |