@wdio/config 6.10.6 → 6.12.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/lib/ConfigParser.d.ts +6 -1
- package/build/lib/ConfigParser.d.ts.map +1 -1
- package/build/lib/ConfigParser.js +2 -2
- package/build/types.d.ts +6 -1
- package/build/types.d.ts.map +1 -1
- package/build/utils.d.ts +8 -3
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +27 -7
- package/package.json +3 -3
|
@@ -3,11 +3,15 @@
|
|
|
3
3
|
/// <reference types="webdriverio" />
|
|
4
4
|
/// <reference types="@wdio/cucumber-framework" />
|
|
5
5
|
import type { ConfigOptions, Hooks } from '../types';
|
|
6
|
+
interface MergeConfig extends Omit<Partial<ConfigOptions>, 'specs' | 'exclude'> {
|
|
7
|
+
specs?: string | string[];
|
|
8
|
+
exclude?: string | string[];
|
|
9
|
+
}
|
|
6
10
|
export default class ConfigParser {
|
|
7
11
|
private _config;
|
|
8
12
|
private _capabilities;
|
|
9
13
|
addConfigFile(filename: string): void;
|
|
10
|
-
merge(object?:
|
|
14
|
+
merge(object?: MergeConfig): void;
|
|
11
15
|
addService(service: Hooks): void;
|
|
12
16
|
getSpecs(capSpecs?: string[], capExclude?: string[]): string[];
|
|
13
17
|
setFilePathToFilterOptions(cliArgFileList: string[], config: string[]): string[];
|
|
@@ -15,4 +19,5 @@ export default class ConfigParser {
|
|
|
15
19
|
getCapabilities(i?: number): WebDriver.DesiredCapabilities | WebDriver.W3CCapabilities | import("webdriverio").MultiRemoteCapabilities | (WebDriver.DesiredCapabilities | WebDriver.W3CCapabilities)[];
|
|
16
20
|
static getFilePaths(patterns: string[], omitWarnings?: boolean): string[];
|
|
17
21
|
}
|
|
22
|
+
export {};
|
|
18
23
|
//# sourceMappingURL=ConfigParser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigParser.d.ts","sourceRoot":"","sources":["../../src/lib/ConfigParser.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"ConfigParser.d.ts","sourceRoot":"","sources":["../../src/lib/ConfigParser.ts"],"names":[],"mappings":";;;;AAWA,OAAO,KAAK,EAAgB,aAAa,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAKlE,UAAU,WAAY,SAAQ,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3E,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAC9B;AAED,MAAM,CAAC,OAAO,OAAO,YAAY;IAC7B,OAAO,CAAC,OAAO,CAAmC;IAClD,OAAO,CAAC,aAAa,CAAoB;IAMzC,aAAa,CAAE,QAAQ,EAAE,MAAM;IAuD/B,KAAK,CAAE,MAAM,GAAE,WAAgB;IA6C/B,UAAU,CAAE,OAAO,EAAE,KAAK;IAkC1B,QAAQ,CAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE;IA8DpD,0BAA0B,CAAE,cAAc,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;IA2BtE,SAAS;IAOT,eAAe,CAAE,CAAC,CAAC,EAAE,MAAM;IAc3B,MAAM,CAAC,YAAY,CAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,YAAY,CAAC,EAAE,OAAO;CAgClE"}
|
|
@@ -23,6 +23,7 @@ class ConfigParser {
|
|
|
23
23
|
}
|
|
24
24
|
const filePath = path_1.default.resolve(process.cwd(), filename);
|
|
25
25
|
try {
|
|
26
|
+
utils_1.loadTypeScriptCompiler();
|
|
26
27
|
const fileConfig = deepmerge_1.default(require(filePath).config, {}, MERGE_OPTIONS);
|
|
27
28
|
const defaultTo = Array.isArray(this._capabilities) ? [] : {};
|
|
28
29
|
this._capabilities = deepmerge_1.default(this._capabilities, fileConfig.capabilities || defaultTo, MERGE_OPTIONS);
|
|
@@ -32,8 +33,7 @@ class ConfigParser {
|
|
|
32
33
|
delete fileConfig[hookName];
|
|
33
34
|
}
|
|
34
35
|
this._config = deepmerge_1.default(this._config, fileConfig, MERGE_OPTIONS);
|
|
35
|
-
|
|
36
|
-
this._config = deepmerge_1.default(utils_1.detectBackend(this._config, isRDC), this._config, MERGE_OPTIONS);
|
|
36
|
+
this._config = deepmerge_1.default(utils_1.detectBackend(this._config), this._config, MERGE_OPTIONS);
|
|
37
37
|
delete this._config.watch;
|
|
38
38
|
}
|
|
39
39
|
catch (e) {
|
package/build/types.d.ts
CHANGED
|
@@ -5,16 +5,21 @@ export declare type Hooks = {
|
|
|
5
5
|
[k in keyof WebdriverIO.HookFunctions]: WebdriverIO.HookFunctions[k] | NonNullable<WebdriverIO.HookFunctions[k]>[];
|
|
6
6
|
};
|
|
7
7
|
export declare type Capabilities = (WebDriver.DesiredCapabilities | WebDriver.W3CCapabilities)[] | WebdriverIO.MultiRemoteCapabilities;
|
|
8
|
+
export declare type Capability = WebDriver.DesiredCapabilities | WebDriver.W3CCapabilities | WebdriverIO.MultiRemoteCapabilities;
|
|
8
9
|
export interface ConfigOptions extends Omit<WebdriverIO.Config, 'capabilities' | keyof WebdriverIO.Hooks>, Hooks {
|
|
9
|
-
automationProtocol?: 'webdriver' | 'devtools';
|
|
10
|
+
automationProtocol?: 'webdriver' | 'devtools' | './protocol-stub';
|
|
10
11
|
spec?: string[];
|
|
11
12
|
suite?: string[];
|
|
12
13
|
capabilities?: Capabilities;
|
|
13
14
|
specFileRetryAttempts?: number;
|
|
14
15
|
cucumberFeaturesWithLineNumbers?: string[];
|
|
15
16
|
specFileRetriesDeferred?: boolean;
|
|
17
|
+
specFileRetries?: number;
|
|
16
18
|
maxInstances?: number;
|
|
17
19
|
}
|
|
20
|
+
export interface SingleConfigOption extends Omit<ConfigOptions, 'capabilities'> {
|
|
21
|
+
capabilities: Capability;
|
|
22
|
+
}
|
|
18
23
|
export declare type DefaultOptions<T> = {
|
|
19
24
|
[k in keyof T]?: {
|
|
20
25
|
type: 'string' | 'number' | 'object' | 'boolean' | 'function';
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AACA,oBAAY,KAAK,GAAG;KACf,CAAC,IAAI,MAAM,WAAW,CAAC,aAAa,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE;CACrH,CAAA;AAED,oBAAY,YAAY,GAAG,CAAC,SAAS,CAAC,mBAAmB,GAAG,SAAS,CAAC,eAAe,CAAC,EAAE,GAAG,WAAW,CAAC,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AACA,oBAAY,KAAK,GAAG;KACf,CAAC,IAAI,MAAM,WAAW,CAAC,aAAa,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE;CACrH,CAAA;AAED,oBAAY,YAAY,GAAG,CAAC,SAAS,CAAC,mBAAmB,GAAG,SAAS,CAAC,eAAe,CAAC,EAAE,GAAG,WAAW,CAAC,uBAAuB,CAAC;AAC/H,oBAAY,UAAU,GAAG,SAAS,CAAC,mBAAmB,GAAG,SAAS,CAAC,eAAe,GAAG,WAAW,CAAC,uBAAuB,CAAC;AAEzH,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,WAAW,CAAC,KAAK,CAAC,EAAE,KAAK;IAC5G,kBAAkB,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,iBAAiB,CAAA;IACjE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,+BAA+B,CAAC,EAAE,MAAM,EAAE,CAAA;IAC1C,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC;IAC3E,YAAY,EAAE,UAAU,CAAA;CAC3B;AAED,oBAAY,cAAc,CAAC,CAAC,IAAI;KAC3B,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;QACb,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAA;QAC7D,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;QACd,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAA;QACjC,KAAK,CAAC,EAAE,MAAM,CAAA;KACjB;CACJ,CAAA"}
|
package/build/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="webdriver" />
|
|
2
2
|
/// <reference types="webdriverio/webdriverio-core" />
|
|
3
|
-
import type { DefaultOptions } from './types';
|
|
3
|
+
import type { DefaultOptions, Capabilities } from './types';
|
|
4
4
|
declare const REGION_MAPPING: {
|
|
5
5
|
us: string;
|
|
6
6
|
eu: string;
|
|
@@ -8,7 +8,10 @@ declare const REGION_MAPPING: {
|
|
|
8
8
|
'us-east-1': string;
|
|
9
9
|
};
|
|
10
10
|
export declare const validObjectOrArray: (object: any) => object is object | any[];
|
|
11
|
-
export declare function getSauceEndpoint(region: keyof typeof REGION_MAPPING, isRDC?:
|
|
11
|
+
export declare function getSauceEndpoint(region: keyof typeof REGION_MAPPING, { isRDC, isVisual }?: {
|
|
12
|
+
isRDC?: boolean;
|
|
13
|
+
isVisual?: boolean;
|
|
14
|
+
}): string;
|
|
12
15
|
export declare function removeLineNumbers(filePath: string): string;
|
|
13
16
|
export declare function isCucumberFeatureWithLineNumber(spec: string | string[]): boolean;
|
|
14
17
|
export declare function isCloudCapability(capabilities: WebDriver.DesiredCapabilities | WebdriverIO.MultiRemoteBrowserOptions): boolean;
|
|
@@ -21,13 +24,15 @@ interface BackendConfigurations {
|
|
|
21
24
|
region?: string;
|
|
22
25
|
headless?: boolean;
|
|
23
26
|
path?: string;
|
|
27
|
+
capabilities?: Capabilities | WebDriver.DesiredCapabilities | WebDriver.W3CCapabilities;
|
|
24
28
|
}
|
|
25
|
-
export declare function detectBackend(options?: BackendConfigurations
|
|
29
|
+
export declare function detectBackend(options?: BackendConfigurations): {
|
|
26
30
|
hostname: string | undefined;
|
|
27
31
|
port: number | undefined;
|
|
28
32
|
protocol: string | undefined;
|
|
29
33
|
path: string | undefined;
|
|
30
34
|
};
|
|
31
35
|
export declare function validateConfig<T>(defaults: DefaultOptions<T>, options: T, keysToKeep?: (keyof T)[]): T;
|
|
36
|
+
export declare function loadTypeScriptCompiler(): void;
|
|
32
37
|
export {};
|
|
33
38
|
//# sourceMappingURL=utils.d.ts.map
|
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":";;AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAU3D,QAAA,MAAM,cAAc;;;;;CAKnB,CAAA;AAED,eAAO,MAAM,kBAAkB,WAAY,GAAG,6BACoB,CAAA;AAElE,wBAAgB,gBAAgB,CAC5B,MAAM,EAAE,MAAM,OAAO,cAAc,EACnC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,UAUpE;AAQD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,UAMjD;AAOD,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,WAGtE;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,SAAS,CAAC,mBAAmB,GAAG,WAAW,CAAC,yBAAyB,WAGpH;AAED,UAAU,qBAAqB;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,YAAY,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC,mBAAmB,GAAG,SAAS,CAAC,eAAe,CAAA;CAC1F;AAKD,wBAAgB,aAAa,CAAC,OAAO,GAAE,qBAA0B;;;;;EAuFhE;AAQD,wBAAgB,cAAc,CAAC,CAAC,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,cAAoB,KA+CxG;AAED,wBAAgB,sBAAsB,SAOrC"}
|
package/build/utils.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateConfig = exports.detectBackend = exports.isCloudCapability = exports.isCucumberFeatureWithLineNumber = exports.removeLineNumbers = exports.getSauceEndpoint = exports.validObjectOrArray = void 0;
|
|
6
|
+
exports.loadTypeScriptCompiler = exports.validateConfig = exports.detectBackend = exports.isCloudCapability = exports.isCucumberFeatureWithLineNumber = exports.removeLineNumbers = exports.getSauceEndpoint = exports.validObjectOrArray = void 0;
|
|
7
|
+
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
8
|
+
const log = logger_1.default('@wdio/config:utils');
|
|
4
9
|
const DEFAULT_HOSTNAME = '127.0.0.1';
|
|
5
10
|
const DEFAULT_PORT = 4444;
|
|
6
11
|
const DEFAULT_PROTOCOL = 'http';
|
|
@@ -14,11 +19,14 @@ const REGION_MAPPING = {
|
|
|
14
19
|
};
|
|
15
20
|
exports.validObjectOrArray = (object) => (Array.isArray(object) && object.length > 0) ||
|
|
16
21
|
(typeof object === 'object' && Object.keys(object).length > 0);
|
|
17
|
-
function getSauceEndpoint(region, isRDC) {
|
|
22
|
+
function getSauceEndpoint(region, { isRDC, isVisual } = {}) {
|
|
18
23
|
const shortRegion = REGION_MAPPING[region] ? region : 'us';
|
|
19
24
|
if (isRDC) {
|
|
20
25
|
return `${shortRegion}1.appium.testobject.com`;
|
|
21
26
|
}
|
|
27
|
+
else if (isVisual) {
|
|
28
|
+
return 'hub.screener.io';
|
|
29
|
+
}
|
|
22
30
|
return `ondemand.${REGION_MAPPING[shortRegion]}saucelabs.com`;
|
|
23
31
|
}
|
|
24
32
|
exports.getSauceEndpoint = getSauceEndpoint;
|
|
@@ -40,8 +48,9 @@ function isCloudCapability(capabilities) {
|
|
|
40
48
|
return Boolean(caps && (caps['bstack:options'] || caps['sauce:options'] || caps['tb:options']));
|
|
41
49
|
}
|
|
42
50
|
exports.isCloudCapability = isCloudCapability;
|
|
43
|
-
function detectBackend(options = {}
|
|
44
|
-
|
|
51
|
+
function detectBackend(options = {}) {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
let { port, hostname, user, key, protocol, region, headless, path, capabilities } = options;
|
|
45
54
|
if (typeof user === 'string' && typeof key === 'string' && key.length === 20) {
|
|
46
55
|
return {
|
|
47
56
|
protocol: protocol || 'https',
|
|
@@ -58,13 +67,14 @@ function detectBackend(options = {}, isRDC = false) {
|
|
|
58
67
|
path: path || LEGACY_PATH
|
|
59
68
|
};
|
|
60
69
|
}
|
|
70
|
+
const isRDC = Boolean(!Array.isArray(capabilities) && ((_a = capabilities) === null || _a === void 0 ? void 0 : _a.testobject_api_key));
|
|
71
|
+
const isVisual = Boolean(!Array.isArray(capabilities) && capabilities && ((_b = capabilities['sauce:visual']) === null || _b === void 0 ? void 0 : _b.apiKey));
|
|
61
72
|
if ((typeof user === 'string' && typeof key === 'string' && key.length === 36) ||
|
|
62
|
-
(
|
|
63
|
-
isRDC) {
|
|
73
|
+
(isRDC || isVisual)) {
|
|
64
74
|
const sauceRegion = headless ? 'us-east-1' : region;
|
|
65
75
|
return {
|
|
66
76
|
protocol: protocol || 'https',
|
|
67
|
-
hostname: hostname || getSauceEndpoint(sauceRegion, isRDC),
|
|
77
|
+
hostname: hostname || getSauceEndpoint(sauceRegion, { isRDC, isVisual }),
|
|
68
78
|
port: port || 443,
|
|
69
79
|
path: path || LEGACY_PATH
|
|
70
80
|
};
|
|
@@ -122,3 +132,13 @@ function validateConfig(defaults, options, keysToKeep = []) {
|
|
|
122
132
|
return params;
|
|
123
133
|
}
|
|
124
134
|
exports.validateConfig = validateConfig;
|
|
135
|
+
function loadTypeScriptCompiler() {
|
|
136
|
+
try {
|
|
137
|
+
require.resolve('ts-node');
|
|
138
|
+
require('ts-node').register({ transpileOnly: true });
|
|
139
|
+
}
|
|
140
|
+
catch (e) {
|
|
141
|
+
return log.debug('Couldn\'t find ts-node package, no TypeScript compiling');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.loadTypeScriptCompiler = loadTypeScriptCompiler;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/config",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.12.1",
|
|
4
4
|
"description": "A helper utility to parse and validate WebdriverIO options",
|
|
5
5
|
"author": "Christian Bromann <christian@saucelabs.com>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/master/packages/wdio-config",
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
},
|
|
24
24
|
"types": "./build/index.d.ts",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@wdio/logger": "6.10.
|
|
26
|
+
"@wdio/logger": "6.10.10",
|
|
27
27
|
"deepmerge": "^4.0.0",
|
|
28
28
|
"glob": "^7.1.2"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "063970498c9b1142482a1a035aa699c64cc8215c"
|
|
34
34
|
}
|