UNPKG

3.25 kBTypeScriptView Raw
1import { ConfigParser } from '@wdio/config/node';
2import type { Services } from '@wdio/types';
3import CLInterface from './interface.js';
4import type { RunCommandArguments } from './types.js';
5export interface EndMessage {
6 cid: string;
7 exitCode: number;
8 specs: string[];
9 retries: number;
10}
11declare class Launcher {
12 #private;
13 private _configFilePath;
14 private _args;
15 private _isWatchMode;
16 configParser: ConfigParser;
17 isMultiremote: boolean;
18 isParallelMultiremote: boolean;
19 runner?: Services.RunnerInstance;
20 interface?: CLInterface;
21 private _exitCode;
22 private _hasTriggeredExitRoutine;
23 private _schedule;
24 private _rid;
25 private _runnerStarted;
26 private _runnerFailed;
27 private _launcher?;
28 private _resolve?;
29 constructor(_configFilePath: string, _args?: Partial<RunCommandArguments>, _isWatchMode?: boolean);
30 /**
31 * run sequence
32 * @return {Promise} that only gets resolved with either an exitCode or an error
33 */
34 run(): Promise<undefined | number>;
35 /**
36 * initialize launcher by loading `tsx` if needed
37 */
38 initialize(): Promise<void>;
39 /**
40 * run without triggering onPrepare/onComplete hooks
41 */
42 private _runMode;
43 /**
44 * Format the specs into an array of objects with files and retries
45 */
46 private _formatSpecs;
47 /**
48 * run multiple single remote tests
49 * @return {Boolean} true if all specs have been run and all instances have finished
50 */
51 private _runSpecs;
52 /**
53 * gets number of all running instances
54 * @return {number} number of running instances
55 */
56 private _getNumberOfRunningInstances;
57 /**
58 * get number of total specs left to complete whole suites
59 * @return {number} specs left to complete suite
60 */
61 private _getNumberOfSpecsLeft;
62 /**
63 * Start instance in a child process.
64 * @param {Array} specs Specs to run
65 * @param {number} cid Capabilities ID
66 * @param {string} rid Runner ID override
67 * @param {number} retries Number of retries remaining
68 */
69 private _startInstance;
70 private _workerHookError;
71 /**
72 * generates a runner id
73 * @param {number} cid capability id (unique identifier for a capability)
74 * @return {String} runner id (combination of cid and test id e.g. 0a, 0b, 1a, 1b ...)
75 */
76 private _getRunnerId;
77 /**
78 * Close test runner process once all child processes have exited
79 * @param {number} cid Capabilities ID
80 * @param {number} exitCode exit code of child process
81 * @param {Array} specs Specs that were run
82 * @param {number} retries Number or retries remaining
83 */
84 private _endHandler;
85 /**
86 * We need exitHandler to catch SIGINT / SIGTERM events.
87 * Make sure all started selenium sessions get closed properly and prevent
88 * having dead driver processes. To do so let the runner end its Selenium
89 * session first before killing
90 */
91 private _exitHandler;
92 /**
93 * returns true if user stopped watch mode, ex with ctrl+c
94 * @returns {boolean}
95 */
96 private _isWatchModeHalted;
97}
98export default Launcher;
99//# sourceMappingURL=launcher.d.ts.map
\No newline at end of file