@wdio/cli 7.17.3 → 7.18.1
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.
- package/build/interface.d.ts +2 -0
- package/build/interface.d.ts.map +1 -1
- package/build/interface.js +3 -0
- package/build/launcher.d.ts +2 -1
- package/build/launcher.d.ts.map +1 -1
- package/build/launcher.js +24 -6
- package/build/templates/wdio.conf.tpl.ejs +16 -7
- package/build/utils.d.ts +5 -0
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +19 -4
- package/package.json +6 -6
package/build/interface.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import type { Options, Workers } from '@wdio/types';
|
|
4
|
+
import { HookError } from './utils';
|
|
4
5
|
interface TestError {
|
|
5
6
|
type: string;
|
|
6
7
|
message: string;
|
|
@@ -62,6 +63,7 @@ export default class WDIOCLInterface extends EventEmitter {
|
|
|
62
63
|
* for testing purposes call console log in a static method
|
|
63
64
|
*/
|
|
64
65
|
log(...args: any[]): any[];
|
|
66
|
+
logHookError(error: HookError): any[];
|
|
65
67
|
/**
|
|
66
68
|
* event handler that is triggered when runner sends up events
|
|
67
69
|
*/
|
package/build/interface.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAErC,OAAO,KAAK,EAAE,OAAO,EAAgB,OAAO,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAErC,OAAO,KAAK,EAAE,OAAO,EAAgB,OAAO,EAAE,MAAM,aAAa,CAAA;AAEjE,OAAO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OAAO,CAAC,GAAG,EAAE,OAAO,SAAI;IAI1D,UAAU,CAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,GAAG;IAI1C,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,SAAI,EAAE,OAAO,SAAK,EAAE,OAAO,GAAE,QAAmB;IAYrG,WAAW,CAAE,OAAO,EAAE,iBAAiB;IAUvC,YAAY,CAAE,KAAK,GAAE,MAAM,EAAO;IAOlC;;OAEG;IACH,MAAM,CAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,OAAO,CAAC,GAAG,GAAG;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE;IASrE;;OAEG;IACH,QAAQ,CAAE,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;IA2BrF;;OAEG;IACH,GAAG,CAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IAMnB,YAAY,CAAE,KAAK,EAAE,SAAS;IAI9B;;OAEG;IACH,SAAS,CAAE,KAAK,EAAE,iBAAiB;IA8CnC,aAAa;IAgBb,cAAc;IAYd,YAAY;IAaZ,QAAQ;CAQX"}
|
package/build/interface.js
CHANGED
|
@@ -160,6 +160,9 @@ class WDIOCLInterface extends events_1.EventEmitter {
|
|
|
160
160
|
console.log(...args);
|
|
161
161
|
return args;
|
|
162
162
|
}
|
|
163
|
+
logHookError(error) {
|
|
164
|
+
return this.log(`${chalk_1.default.red(error.name)} in "${error.origin}"\n${chalk_1.default.red(error.stack || error.message)}`);
|
|
165
|
+
}
|
|
163
166
|
/**
|
|
164
167
|
* event handler that is triggered when runner sends up events
|
|
165
168
|
*/
|
package/build/launcher.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ declare class Launcher {
|
|
|
64
64
|
* @param {Number} retries Number of retries remaining
|
|
65
65
|
*/
|
|
66
66
|
startInstance(specs: string[], caps: Capabilities.DesiredCapabilities | Capabilities.W3CCapabilities | Capabilities.MultiRemoteCapabilities, cid: number, rid: string | undefined, retries: number): Promise<void>;
|
|
67
|
+
private _workerHookError;
|
|
67
68
|
/**
|
|
68
69
|
* generates a runner id
|
|
69
70
|
* @param {Number} cid capability id (unique identifier for a capability)
|
|
@@ -77,7 +78,7 @@ declare class Launcher {
|
|
|
77
78
|
* @param {Array} specs Specs that were run
|
|
78
79
|
* @param {Number} retries Number or retries remaining
|
|
79
80
|
*/
|
|
80
|
-
endHandler({ cid: rid, exitCode, specs, retries }: EndMessage): void
|
|
81
|
+
endHandler({ cid: rid, exitCode, specs, retries }: EndMessage): Promise<void>;
|
|
81
82
|
/**
|
|
82
83
|
* We need exitHandler to catch SIGINT / SIGTERM events.
|
|
83
84
|
* Make sure all started selenium sessions get closed properly and prevent
|
package/build/launcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAElE,OAAO,WAAW,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAmB7C,UAAU,UAAU;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,CAAA;CAClB;AAED,cAAM,QAAQ;IAiBN,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,YAAY;IAlBxB,YAAY,EAAE,YAAY,CAAA;I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;OAGG;IACH,OAAO,CAAC,kBAAkB;CAG7B;AAED,eAAe,QAAQ,CAAA"}
|
package/build/launcher.js
CHANGED
|
@@ -87,11 +87,14 @@ class Launcher {
|
|
|
87
87
|
exitCode = await this.runMode(config, caps);
|
|
88
88
|
/**
|
|
89
89
|
* run onComplete hook
|
|
90
|
-
*
|
|
90
|
+
* Even if it fails we still want to see result and end logger stream.
|
|
91
|
+
* Also ensure that user hooks are run before service hooks so that e.g.
|
|
92
|
+
* a user can use plugin service, e.g. shared store service is still
|
|
93
|
+
* available running hooks in this order
|
|
91
94
|
*/
|
|
92
95
|
log.info('Run onComplete hook');
|
|
93
|
-
await (0, utils_2.runServiceHook)(this._launcher, 'onComplete', exitCode, config, caps);
|
|
94
96
|
const onCompleteResults = await (0, utils_2.runOnCompleteHook)(config.onComplete, config, caps, exitCode, this.interface.result);
|
|
97
|
+
await (0, utils_2.runServiceHook)(this._launcher, 'onComplete', exitCode, config, caps);
|
|
95
98
|
// if any of the onComplete hooks failed, update the exit code
|
|
96
99
|
exitCode = onCompleteResults.includes(1) ? 1 : exitCode;
|
|
97
100
|
await logger_1.default.waitForBuffer();
|
|
@@ -107,6 +110,7 @@ class Launcher {
|
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
112
|
if (error) {
|
|
113
|
+
this.interface.logHookError(error);
|
|
110
114
|
throw error;
|
|
111
115
|
}
|
|
112
116
|
return exitCode;
|
|
@@ -318,8 +322,10 @@ class Launcher {
|
|
|
318
322
|
this._runnerStarted++;
|
|
319
323
|
// run worker hook to allow modify runtime and capabilities of a specific worker
|
|
320
324
|
log.info('Run onWorkerStart hook');
|
|
321
|
-
await (0, utils_2.runLauncherHook)(config.onWorkerStart, runnerId, caps, specs, this._args, execArgv)
|
|
322
|
-
|
|
325
|
+
await (0, utils_2.runLauncherHook)(config.onWorkerStart, runnerId, caps, specs, this._args, execArgv)
|
|
326
|
+
.catch((error) => this._workerHookError(error));
|
|
327
|
+
await (0, utils_2.runServiceHook)(this._launcher, 'onWorkerStart', runnerId, caps, specs, this._args, execArgv)
|
|
328
|
+
.catch((error) => this._workerHookError(error));
|
|
323
329
|
// prefer launcher settings in capabilities over general launcher
|
|
324
330
|
const worker = this.runner.run({
|
|
325
331
|
cid: runnerId,
|
|
@@ -335,6 +341,12 @@ class Launcher {
|
|
|
335
341
|
worker.on('error', this.interface.onMessage.bind(this.interface));
|
|
336
342
|
worker.on('exit', this.endHandler.bind(this));
|
|
337
343
|
}
|
|
344
|
+
_workerHookError(error) {
|
|
345
|
+
this.interface.logHookError(error);
|
|
346
|
+
if (this._resolve) {
|
|
347
|
+
this._resolve(1);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
338
350
|
/**
|
|
339
351
|
* generates a runner id
|
|
340
352
|
* @param {Number} cid capability id (unique identifier for a capability)
|
|
@@ -353,7 +365,7 @@ class Launcher {
|
|
|
353
365
|
* @param {Array} specs Specs that were run
|
|
354
366
|
* @param {Number} retries Number or retries remaining
|
|
355
367
|
*/
|
|
356
|
-
endHandler({ cid: rid, exitCode, specs, retries }) {
|
|
368
|
+
async endHandler({ cid: rid, exitCode, specs, retries }) {
|
|
357
369
|
const passed = this._isWatchModeHalted() || exitCode === 0;
|
|
358
370
|
if (!passed && retries > 0) {
|
|
359
371
|
// Default is true, so test for false explicitly
|
|
@@ -372,11 +384,17 @@ class Launcher {
|
|
|
372
384
|
}
|
|
373
385
|
/**
|
|
374
386
|
* Update schedule now this process has ended
|
|
387
|
+
* get cid (capability id) from rid (runner id)
|
|
375
388
|
*/
|
|
376
|
-
// get cid (capability id) from rid (runner id)
|
|
377
389
|
const cid = parseInt(rid, 10);
|
|
378
390
|
this._schedule[cid].availableInstances++;
|
|
379
391
|
this._schedule[cid].runningInstances--;
|
|
392
|
+
log.info('Run onWorkerEnd hook');
|
|
393
|
+
const config = this.configParser.getConfig();
|
|
394
|
+
await (0, utils_2.runLauncherHook)(config.onWorkerEnd, rid, exitCode, specs, retries)
|
|
395
|
+
.catch((error) => this._workerHookError(error));
|
|
396
|
+
await (0, utils_2.runServiceHook)(this._launcher, 'onWorkerEnd', rid, exitCode, specs, retries)
|
|
397
|
+
.catch((error) => this._workerHookError(error));
|
|
380
398
|
/**
|
|
381
399
|
* do nothing if
|
|
382
400
|
* - there are specs to be executed
|
|
@@ -4,20 +4,20 @@
|
|
|
4
4
|
// Runner Configuration
|
|
5
5
|
// ====================
|
|
6
6
|
//<%
|
|
7
|
-
if(answers.isUsingTypeScript){ %>
|
|
7
|
+
if(answers.isUsingTypeScript){ %>
|
|
8
8
|
//
|
|
9
9
|
// =====================
|
|
10
10
|
// ts-node Configurations
|
|
11
11
|
// =====================
|
|
12
|
-
//
|
|
12
|
+
//
|
|
13
13
|
// You can write tests using TypeScript to get autocompletion and type safety.
|
|
14
|
-
// You will need typescript and ts-node installed as devDependencies.
|
|
15
|
-
// WebdriverIO will automatically detect if these dependencies are installed
|
|
16
|
-
// and will compile your config and tests for you.
|
|
14
|
+
// You will need typescript and ts-node installed as devDependencies.
|
|
15
|
+
// WebdriverIO will automatically detect if these dependencies are installed
|
|
16
|
+
// and will compile your config and tests for you.
|
|
17
17
|
// If you need to configure how ts-node runs please use the
|
|
18
18
|
// environment variables for ts-node or use wdio config's autoCompileOpts section.
|
|
19
19
|
//
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
autoCompileOpts: {
|
|
22
22
|
autoCompile: true,
|
|
23
23
|
// see https://github.com/TypeStrong/ts-node#cli-and-programmatic-options
|
|
@@ -279,11 +279,20 @@
|
|
|
279
279
|
* @param {String} cid capability id (e.g 0-0)
|
|
280
280
|
* @param {[type]} caps object containing capabilities for session that will be spawn in the worker
|
|
281
281
|
* @param {[type]} specs specs to be run in the worker process
|
|
282
|
-
* @param {[type]} args object that will be merged with the main configuration once worker is
|
|
282
|
+
* @param {[type]} args object that will be merged with the main configuration once worker is initialized
|
|
283
283
|
* @param {[type]} execArgv list of string arguments passed to the worker process
|
|
284
284
|
*/
|
|
285
285
|
// onWorkerStart: function (cid, caps, specs, args, execArgv) {
|
|
286
286
|
// },
|
|
287
|
+
/**
|
|
288
|
+
* Gets executed just after a worker process has exited.
|
|
289
|
+
* @param {String} cid capability id (e.g 0-0)
|
|
290
|
+
* @param {Number} exitCode 0 - success, 1 - fail
|
|
291
|
+
* @param {[type]} specs specs to be run in the worker process
|
|
292
|
+
* @param {Number} retries number of retries used
|
|
293
|
+
*/
|
|
294
|
+
// onWorkerEnd: function (cid, exitCode, specs, retries) {
|
|
295
|
+
// },
|
|
287
296
|
/**
|
|
288
297
|
* Gets executed just before initialising the webdriver session and test framework. It allows you
|
|
289
298
|
* to manipulate configurations depending on the capability or spec.
|
package/build/utils.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { SevereServiceError } from 'webdriverio';
|
|
1
2
|
import type { Options, Capabilities, Services } from '@wdio/types';
|
|
2
3
|
import { ReplCommandArguments, Questionnair, SupportedPackage, OnCompleteResult, ParsedAnswers } from './types';
|
|
4
|
+
export declare class HookError extends SevereServiceError {
|
|
5
|
+
origin: string;
|
|
6
|
+
constructor(message: string, origin: string);
|
|
7
|
+
}
|
|
3
8
|
/**
|
|
4
9
|
* run service launch sequences
|
|
5
10
|
*/
|
package/build/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAGhD,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAElE,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAQ/G,qBAAa,SAAU,SAAQ,kBAAkB;IACtC,MAAM,EAA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;;;;;;;;;;;;;;EAwBxD;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAE,QAAQ,EAAE,MAAM,WAExC;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAE,GAAG,EAAE,MAAM,WActC;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAE,OAAO,EAAE,aAAa,iBA6B9D;AAED,wBAAsB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CA2BpE;AAED,wBAAgB,wBAAwB,CAAE,OAAO,EAAE,YAAY;;;;;EA+B9D;AAED,wBAAgB,eAAe,CAAE,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,MAAM,UAIhF"}
|
package/build/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getDefaultFiles = exports.getPathForFileGeneration = exports.getAnswers = exports.generateTestFiles = exports.hasPackage = exports.hasFile = exports.getCapabilities = exports.validateServiceAnswers = exports.renderConfigurationFile = exports.convertPackageHashToObject = exports.addServiceDeps = exports.replaceConfig = exports.findInConfig = exports.getRunnerName = exports.runOnCompleteHook = exports.runLauncherHook = exports.runServiceHook = void 0;
|
|
6
|
+
exports.getDefaultFiles = exports.getPathForFileGeneration = exports.getAnswers = exports.generateTestFiles = exports.hasPackage = exports.hasFile = exports.getCapabilities = exports.validateServiceAnswers = exports.renderConfigurationFile = exports.convertPackageHashToObject = exports.addServiceDeps = exports.replaceConfig = exports.findInConfig = exports.getRunnerName = exports.runOnCompleteHook = exports.runLauncherHook = exports.runServiceHook = exports.HookError = void 0;
|
|
7
7
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
8
|
const ejs_1 = __importDefault(require("ejs"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
@@ -17,6 +17,13 @@ const constants_1 = require("./constants");
|
|
|
17
17
|
const log = (0, logger_1.default)('@wdio/cli:utils');
|
|
18
18
|
const TEMPLATE_ROOT_DIR = path_1.default.join(__dirname, 'templates', 'exampleFiles');
|
|
19
19
|
const renderFile = (0, util_1.promisify)(ejs_1.default.renderFile);
|
|
20
|
+
class HookError extends webdriverio_1.SevereServiceError {
|
|
21
|
+
constructor(message, origin) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.origin = origin;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.HookError = HookError;
|
|
20
27
|
/**
|
|
21
28
|
* run service launch sequences
|
|
22
29
|
*/
|
|
@@ -31,7 +38,7 @@ async function runServiceHook(launcher, hookName, ...args) {
|
|
|
31
38
|
catch (err) {
|
|
32
39
|
const message = `A service failed in the '${hookName}' hook\n${err.stack}\n\n`;
|
|
33
40
|
if (err instanceof webdriverio_1.SevereServiceError) {
|
|
34
|
-
return { status: 'rejected', reason: message };
|
|
41
|
+
return { status: 'rejected', reason: message, origin: hookName };
|
|
35
42
|
}
|
|
36
43
|
log.error(`${message}Continue...`);
|
|
37
44
|
}
|
|
@@ -41,7 +48,7 @@ async function runServiceHook(launcher, hookName, ...args) {
|
|
|
41
48
|
}
|
|
42
49
|
const rejectedHooks = results.filter(p => p && p.status === 'rejected');
|
|
43
50
|
if (rejectedHooks.length) {
|
|
44
|
-
return Promise.reject(new
|
|
51
|
+
return Promise.reject(new HookError(`\n${rejectedHooks.map(p => p && p.reason).join()}\n\nStopping runner...`, hookName));
|
|
45
52
|
}
|
|
46
53
|
});
|
|
47
54
|
}
|
|
@@ -53,10 +60,15 @@ exports.runServiceHook = runServiceHook;
|
|
|
53
60
|
* @param {Object} capabilities
|
|
54
61
|
*/
|
|
55
62
|
async function runLauncherHook(hook, ...args) {
|
|
56
|
-
const catchFn = (e) => log.error(`Error in hook: ${e.stack}`);
|
|
57
63
|
if (typeof hook === 'function') {
|
|
58
64
|
hook = [hook];
|
|
59
65
|
}
|
|
66
|
+
const catchFn = (e) => {
|
|
67
|
+
log.error(`Error in hook: ${e.stack}`);
|
|
68
|
+
if (e instanceof webdriverio_1.SevereServiceError) {
|
|
69
|
+
throw new HookError(e.message, hook[0].name);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
60
72
|
return Promise.all(hook.map((hook) => {
|
|
61
73
|
try {
|
|
62
74
|
return hook(...args);
|
|
@@ -86,6 +98,9 @@ async function runOnCompleteHook(onCompleteHook, config, capabilities, exitCode,
|
|
|
86
98
|
}
|
|
87
99
|
catch (err) {
|
|
88
100
|
log.error(`Error in onCompleteHook: ${err.stack}`);
|
|
101
|
+
if (err instanceof webdriverio_1.SevereServiceError) {
|
|
102
|
+
throw new HookError(err.message, 'onComplete');
|
|
103
|
+
}
|
|
89
104
|
return 1;
|
|
90
105
|
}
|
|
91
106
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/cli",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.18.1",
|
|
4
4
|
"description": "WebdriverIO testrunner command line interface",
|
|
5
5
|
"author": "Christian Bromann <christian@saucelabs.com>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-cli",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"@types/lodash.union": "^4.6.6",
|
|
38
38
|
"@types/node": "^17.0.4",
|
|
39
39
|
"@types/recursive-readdir": "^2.2.0",
|
|
40
|
-
"@wdio/config": "7.
|
|
40
|
+
"@wdio/config": "7.18.0",
|
|
41
41
|
"@wdio/logger": "7.17.3",
|
|
42
|
-
"@wdio/types": "7.
|
|
43
|
-
"@wdio/utils": "7.
|
|
42
|
+
"@wdio/types": "7.18.0",
|
|
43
|
+
"@wdio/utils": "7.18.0",
|
|
44
44
|
"async-exit-hook": "^2.0.1",
|
|
45
45
|
"chalk": "^4.0.0",
|
|
46
46
|
"chokidar": "^3.0.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"lodash.union": "^4.6.0",
|
|
54
54
|
"mkdirp": "^1.0.4",
|
|
55
55
|
"recursive-readdir": "^2.2.2",
|
|
56
|
-
"webdriverio": "7.
|
|
56
|
+
"webdriverio": "7.18.1",
|
|
57
57
|
"yargs": "^17.0.0",
|
|
58
58
|
"yarn-install": "^1.0.0"
|
|
59
59
|
},
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
63
|
"types": "./build/index.d.ts",
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "92f073f8d54b51ff7473d2318fcec9927608c7ca"
|
|
65
65
|
}
|