@wdio/cli 7.16.16 → 7.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/package.json +4 -4
  2. package/build/@types/yarn-install.d.ts +0 -16
  3. package/build/@types/yarn-install.d.ts.map +0 -1
  4. package/build/@types/yarn-install.js +0 -1
  5. package/build/commands/config.d.ts +0 -64
  6. package/build/commands/config.d.ts.map +0 -1
  7. package/build/commands/config.js +0 -236
  8. package/build/commands/install.d.ts +0 -18
  9. package/build/commands/install.d.ts.map +0 -1
  10. package/build/commands/install.js +0 -112
  11. package/build/commands/repl.d.ts +0 -36
  12. package/build/commands/repl.d.ts.map +0 -1
  13. package/build/commands/repl.js +0 -62
  14. package/build/commands/run.d.ts +0 -172
  15. package/build/commands/run.d.ts.map +0 -1
  16. package/build/commands/run.js +0 -172
  17. package/build/constants.d.ts +0 -485
  18. package/build/constants.d.ts.map +0 -1
  19. package/build/constants.js +0 -370
  20. package/build/index.d.ts +0 -5
  21. package/build/index.d.ts.map +0 -1
  22. package/build/index.js +0 -84
  23. package/build/interface.d.ts +0 -75
  24. package/build/interface.d.ts.map +0 -1
  25. package/build/interface.js +0 -245
  26. package/build/launcher.d.ts +0 -95
  27. package/build/launcher.d.ts.map +0 -1
  28. package/build/launcher.js +0 -418
  29. package/build/templates/afterTest.ejs +0 -20
  30. package/build/templates/exampleFiles/cucumber/features/login.feature +0 -12
  31. package/build/templates/exampleFiles/cucumber/step_definitions/steps.js.ejs +0 -52
  32. package/build/templates/exampleFiles/jasmine/example.e2e.js.ejs +0 -42
  33. package/build/templates/exampleFiles/mocha/example.e2e.js.ejs +0 -42
  34. package/build/templates/exampleFiles/pageobjects/login.page.js.ejs +0 -44
  35. package/build/templates/exampleFiles/pageobjects/page.js.ejs +0 -13
  36. package/build/templates/exampleFiles/pageobjects/secure.page.js.ejs +0 -19
  37. package/build/templates/reporters.ejs +0 -14
  38. package/build/templates/wdio.conf.tpl.ejs +0 -448
  39. package/build/types.d.ts +0 -110
  40. package/build/types.d.ts.map +0 -1
  41. package/build/types.js +0 -2
  42. package/build/utils.d.ts +0 -82
  43. package/build/utils.d.ts.map +0 -1
  44. package/build/utils.js +0 -345
  45. package/build/watcher.d.ts +0 -34
  46. package/build/watcher.d.ts.map +0 -1
  47. package/build/watcher.js +0 -150
@@ -1,245 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const chalk_1 = __importDefault(require("chalk"));
7
- const events_1 = require("events");
8
- const logger_1 = __importDefault(require("@wdio/logger"));
9
- const utils_1 = require("./utils");
10
- const log = (0, logger_1.default)('@wdio/cli');
11
- class WDIOCLInterface extends events_1.EventEmitter {
12
- constructor(_config, totalWorkerCnt, _isWatchMode = false) {
13
- super();
14
- this._config = _config;
15
- this.totalWorkerCnt = totalWorkerCnt;
16
- this._isWatchMode = _isWatchMode;
17
- this.result = {
18
- finished: 0,
19
- passed: 0,
20
- retries: 0,
21
- failed: 0
22
- };
23
- this._jobs = new Map();
24
- this._skippedSpecs = 0;
25
- this._inDebugMode = false;
26
- this._start = new Date();
27
- this._messages = {
28
- reporter: {},
29
- debugger: {}
30
- };
31
- /**
32
- * Colors can be forcibly enabled/disabled with env variable `FORCE_COLOR`
33
- * `FORCE_COLOR=1` - forcibly enable colors
34
- * `FORCE_COLOR=0` - forcibly disable colors
35
- */
36
- this.hasAnsiSupport = chalk_1.default.supportsColor.hasBasic;
37
- this.totalWorkerCnt = totalWorkerCnt;
38
- this._isWatchMode = _isWatchMode;
39
- this._specFileRetries = _config.specFileRetries || 0;
40
- this._specFileRetriesDelay = _config.specFileRetriesDelay || 0;
41
- this.on('job:start', this.addJob.bind(this));
42
- this.on('job:end', this.clearJob.bind(this));
43
- this.setup();
44
- this.onStart();
45
- }
46
- setup() {
47
- this._jobs = new Map();
48
- this._start = new Date();
49
- /**
50
- * The relationship between totalWorkerCnt and these counters are as follows:
51
- * totalWorkerCnt - retries = finished = passed + failed
52
- */
53
- this.result = {
54
- finished: 0,
55
- passed: 0,
56
- retries: 0,
57
- failed: 0
58
- };
59
- this._messages = {
60
- reporter: {},
61
- debugger: {}
62
- };
63
- }
64
- onStart() {
65
- this.log(chalk_1.default.bold(`\nExecution of ${chalk_1.default.blue(this.totalWorkerCnt)} workers started at`), this._start.toISOString());
66
- if (this._inDebugMode) {
67
- this.log(chalk_1.default.bgYellow.black('DEBUG mode enabled!'));
68
- }
69
- if (this._isWatchMode) {
70
- this.log(chalk_1.default.bgYellow.black('WATCH mode enabled!'));
71
- }
72
- this.log('');
73
- }
74
- onSpecRunning(rid) {
75
- this.onJobComplete(rid, this._jobs.get(rid), 0, chalk_1.default.bold.cyan('RUNNING'));
76
- }
77
- onSpecRetry(rid, job, retries = 0) {
78
- const delayMsg = this._specFileRetriesDelay > 0 ? ` after ${this._specFileRetriesDelay}s` : '';
79
- this.onJobComplete(rid, job, retries, chalk_1.default.bold(chalk_1.default.yellow('RETRYING') + delayMsg));
80
- }
81
- onSpecPass(rid, job, retries = 0) {
82
- this.onJobComplete(rid, job, retries, chalk_1.default.bold.green('PASSED'));
83
- }
84
- onSpecFailure(rid, job, retries = 0) {
85
- this.onJobComplete(rid, job, retries, chalk_1.default.bold.red('FAILED'));
86
- }
87
- onSpecSkip(rid, job) {
88
- this.onJobComplete(rid, job, 0, 'SKIPPED', log.info);
89
- }
90
- onJobComplete(cid, job, retries = 0, message = '', _logger = this.log) {
91
- const details = [`[${cid}]`, message];
92
- if (job) {
93
- details.push('in', (0, utils_1.getRunnerName)(job.caps), this.getFilenames(job.specs));
94
- }
95
- if (retries > 0) {
96
- details.push(`(${retries} retries)`);
97
- }
98
- return _logger(...details);
99
- }
100
- onTestError(payload) {
101
- var _a, _b, _c;
102
- const error = {
103
- type: ((_a = payload.error) === null || _a === void 0 ? void 0 : _a.type) || 'Error',
104
- message: ((_b = payload.error) === null || _b === void 0 ? void 0 : _b.message) || (typeof payload.error === 'string' ? payload.error : 'Unknown error.'),
105
- stack: (_c = payload.error) === null || _c === void 0 ? void 0 : _c.stack
106
- };
107
- return this.log(`[${payload.cid}]`, `${chalk_1.default.red(error.type)} in "${payload.fullTitle}"\n${chalk_1.default.red(error.stack || error.message)}`);
108
- }
109
- getFilenames(specs = []) {
110
- if (specs.length > 0) {
111
- return '- ' + specs.join(', ').replace(new RegExp(`${process.cwd()}`, 'g'), '');
112
- }
113
- return '';
114
- }
115
- /**
116
- * add job to interface
117
- */
118
- addJob({ cid, caps, specs, hasTests }) {
119
- this._jobs.set(cid, { caps, specs, hasTests });
120
- if (hasTests) {
121
- this.onSpecRunning(cid);
122
- }
123
- else {
124
- this._skippedSpecs++;
125
- }
126
- }
127
- /**
128
- * clear job from interface
129
- */
130
- clearJob({ cid, passed, retries }) {
131
- const job = this._jobs.get(cid);
132
- this._jobs.delete(cid);
133
- const retryAttempts = this._specFileRetries - retries;
134
- const retry = !passed && retries > 0;
135
- if (!retry) {
136
- this.result.finished++;
137
- }
138
- if (job && job.hasTests === false) {
139
- return this.onSpecSkip(cid, job);
140
- }
141
- if (passed) {
142
- this.result.passed++;
143
- this.onSpecPass(cid, job, retryAttempts);
144
- }
145
- else if (retry) {
146
- this.totalWorkerCnt++;
147
- this.result.retries++;
148
- this.onSpecRetry(cid, job, retryAttempts);
149
- }
150
- else {
151
- this.result.failed++;
152
- this.onSpecFailure(cid, job, retryAttempts);
153
- }
154
- }
155
- /**
156
- * for testing purposes call console log in a static method
157
- */
158
- log(...args) {
159
- // eslint-disable-next-line no-console
160
- console.log(...args);
161
- return args;
162
- }
163
- /**
164
- * event handler that is triggered when runner sends up events
165
- */
166
- onMessage(event) {
167
- if (event.name === 'reporterRealTime') {
168
- this.log(event.content);
169
- return;
170
- }
171
- if (event.origin === 'debugger' && event.name === 'start') {
172
- this.log(chalk_1.default.yellow(event.params.introMessage));
173
- this._inDebugMode = true;
174
- return this._inDebugMode;
175
- }
176
- if (event.origin === 'debugger' && event.name === 'stop') {
177
- this._inDebugMode = false;
178
- return this._inDebugMode;
179
- }
180
- if (event.name === 'testFrameworkInit') {
181
- return this.emit('job:start', event.content);
182
- }
183
- if (!event.origin) {
184
- return log.warn(`Can't identify message from worker: ${JSON.stringify(event)}, ignoring!`);
185
- }
186
- if (event.origin === 'worker' && event.name === 'error') {
187
- return this.log(`[${event.cid}]`, chalk_1.default.white.bgRed.bold(' Error: '), event.content.message || event.content.stack || event.content);
188
- }
189
- if (event.origin !== 'reporter' && event.origin !== 'debugger') {
190
- return this.log(event.cid, event.origin, event.name, event.content);
191
- }
192
- if (event.name === 'printFailureMessage') {
193
- return this.onTestError(event.content);
194
- }
195
- if (!this._messages[event.origin][event.name]) {
196
- this._messages[event.origin][event.name] = [];
197
- }
198
- this._messages[event.origin][event.name].push(event.content);
199
- if (this._isWatchMode) {
200
- this.printReporters();
201
- }
202
- }
203
- sigintTrigger() {
204
- /**
205
- * allow to exit repl mode via Ctrl+C
206
- */
207
- if (this._inDebugMode) {
208
- return false;
209
- }
210
- const isRunning = this._jobs.size !== 0;
211
- const shutdownMessage = isRunning
212
- ? 'Ending WebDriver sessions gracefully ...\n' +
213
- '(press ctrl+c again to hard kill the runner)'
214
- : 'Ended WebDriver sessions gracefully after a SIGINT signal was received!';
215
- return this.log('\n\n' + shutdownMessage);
216
- }
217
- printReporters() {
218
- /**
219
- * print reporter output
220
- */
221
- const reporter = this._messages.reporter;
222
- this._messages.reporter = {};
223
- for (const [reporterName, messages] of Object.entries(reporter)) {
224
- this.log('\n', chalk_1.default.bold.magenta(`"${reporterName}" Reporter:`));
225
- this.log(messages.join(''));
226
- }
227
- }
228
- printSummary() {
229
- const totalJobs = this.totalWorkerCnt - this.result.retries;
230
- const elapsed = (new Date(Date.now() - this._start.getTime())).toUTCString().match(/(\d\d:\d\d:\d\d)/)[0];
231
- const retries = this.result.retries ? chalk_1.default.yellow(this.result.retries, 'retries') + ', ' : '';
232
- const failed = this.result.failed ? chalk_1.default.red(this.result.failed, 'failed') + ', ' : '';
233
- const skipped = this._skippedSpecs > 0 ? chalk_1.default.gray(this._skippedSpecs, 'skipped') + ', ' : '';
234
- const percentCompleted = totalJobs ? Math.round(this.result.finished / totalJobs * 100) : 0;
235
- return this.log('\nSpec Files:\t', chalk_1.default.green(this.result.passed, 'passed') + ', ' + retries + failed + skipped + totalJobs, 'total', `(${percentCompleted}% completed)`, 'in', elapsed, '\n');
236
- }
237
- finalise() {
238
- if (this._isWatchMode) {
239
- return;
240
- }
241
- this.printReporters();
242
- this.printSummary();
243
- }
244
- }
245
- exports.default = WDIOCLInterface;
@@ -1,95 +0,0 @@
1
- import { ConfigParser } from '@wdio/config';
2
- import type { Options, Capabilities, Services } from '@wdio/types';
3
- import CLInterface from './interface';
4
- import { RunCommandArguments } from './types';
5
- interface EndMessage {
6
- cid: string;
7
- exitCode: number;
8
- specs: string[];
9
- retries: number;
10
- }
11
- declare class Launcher {
12
- private _configFilePath;
13
- private _args;
14
- private _isWatchMode;
15
- configParser: ConfigParser;
16
- isMultiremote: boolean;
17
- runner: Services.RunnerInstance;
18
- interface: CLInterface;
19
- private _exitCode;
20
- private _hasTriggeredExitRoutine;
21
- private _schedule;
22
- private _rid;
23
- private _runnerStarted;
24
- private _runnerFailed;
25
- private _launcher?;
26
- private _resolve?;
27
- constructor(_configFilePath: string, _args?: Partial<RunCommandArguments>, _isWatchMode?: boolean);
28
- /**
29
- * run sequence
30
- * @return {Promise} that only gets resolves with either an exitCode or an error
31
- */
32
- run(): Promise<number>;
33
- /**
34
- * run without triggering onPrepare/onComplete hooks
35
- */
36
- runMode(config: Required<Options.Testrunner>, caps: Capabilities.RemoteCapabilities): Promise<number>;
37
- /**
38
- * Format the specs into an array of objects with files and retries
39
- */
40
- formatSpecs(capabilities: (Capabilities.DesiredCapabilities | Capabilities.W3CCapabilities | Capabilities.RemoteCapabilities), specFileRetries: number): {
41
- files: string[];
42
- retries: number;
43
- }[];
44
- /**
45
- * run multiple single remote tests
46
- * @return {Boolean} true if all specs have been run and all instances have finished
47
- */
48
- runSpecs(): boolean;
49
- /**
50
- * gets number of all running instances
51
- * @return {number} number of running instances
52
- */
53
- getNumberOfRunningInstances(): number;
54
- /**
55
- * get number of total specs left to complete whole suites
56
- * @return {number} specs left to complete suite
57
- */
58
- getNumberOfSpecsLeft(): number;
59
- /**
60
- * Start instance in a child process.
61
- * @param {Array} specs Specs to run
62
- * @param {Number} cid Capabilities ID
63
- * @param {String} rid Runner ID override
64
- * @param {Number} retries Number of retries remaining
65
- */
66
- startInstance(specs: string[], caps: Capabilities.DesiredCapabilities | Capabilities.W3CCapabilities | Capabilities.MultiRemoteCapabilities, cid: number, rid: string | undefined, retries: number): Promise<void>;
67
- /**
68
- * generates a runner id
69
- * @param {Number} cid capability id (unique identifier for a capability)
70
- * @return {String} runner id (combination of cid and test id e.g. 0a, 0b, 1a, 1b ...)
71
- */
72
- getRunnerId(cid: number): string;
73
- /**
74
- * Close test runner process once all child processes have exited
75
- * @param {Number} cid Capabilities ID
76
- * @param {Number} exitCode exit code of child process
77
- * @param {Array} specs Specs that were run
78
- * @param {Number} retries Number or retries remaining
79
- */
80
- endHandler({ cid: rid, exitCode, specs, retries }: EndMessage): void;
81
- /**
82
- * We need exitHandler to catch SIGINT / SIGTERM events.
83
- * Make sure all started selenium sessions get closed properly and prevent
84
- * having dead driver processes. To do so let the runner end its Selenium
85
- * session first before killing
86
- */
87
- exitHandler(callback?: (value: void) => void): void | Promise<void>;
88
- /**
89
- * returns true if user stopped watch mode, ex with ctrl+c
90
- * @returns {boolean}
91
- */
92
- private _isWatchModeHalted;
93
- }
94
- export default Launcher;
95
- //# sourceMappingURL=launcher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C,OAAO,KAAK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