@wdio/config 7.19.0 → 7.20.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.
- package/build/utils.d.ts +1 -0
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +21 -5
- package/package.json +5 -4
package/build/utils.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export declare function isCloudCapability(caps: Capabilities.Capabilities): bool
|
|
|
23
23
|
*/
|
|
24
24
|
export declare function validateConfig<T>(defaults: Options.Definition<T>, options: T, keysToKeep?: (keyof T)[]): T;
|
|
25
25
|
export declare function loadAutoCompilers(autoCompileConfig: Options.AutoCompileConfig, requireService: ModuleRequireService): boolean | undefined;
|
|
26
|
+
export declare function validateTsConfigPaths(tsNodeOpts?: any): void;
|
|
26
27
|
export declare function loadTypeScriptCompiler(tsNodeOpts: any, tsConfigPathsOpts: Options.TSConfigPathsOptions | undefined, requireService: ModuleRequireService): boolean;
|
|
27
28
|
export declare function loadBabelCompiler(babelOpts: Record<string, any> | undefined, requireService: ModuleRequireService): boolean;
|
|
28
29
|
//# 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":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAInD,eAAO,MAAM,kBAAkB,WAAY,GAAG,6BACoB,CAAA;AAElE;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,UAMjD;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,WAGtE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,CAAC,YAAY,WAEhE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,cAAoB,KA+C5G;AAED,wBAAgB,iBAAiB,CAAC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE,cAAc,EAAE,oBAAoB,uBAgBnH;AAED,wBAAgB,qBAAqB,CAAC,UAAU,GAAE,GAAQ,QAUzD;AAED,wBAAgB,sBAAsB,CAClC,UAAU,KAAU,EACpB,iBAAiB,EAAE,OAAO,CAAC,oBAAoB,GAAG,SAAS,EAC3D,cAAc,EAAE,oBAAoB,WAmBvC;AAED,wBAAgB,iBAAiB,CAAE,SAAS,iCAA0B,EAAE,cAAc,EAAE,oBAAoB,WAiB3G"}
|
package/build/utils.js
CHANGED
|
@@ -3,7 +3,9 @@ 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.loadBabelCompiler = exports.loadTypeScriptCompiler = exports.loadAutoCompilers = exports.validateConfig = exports.isCloudCapability = exports.isCucumberFeatureWithLineNumber = exports.removeLineNumbers = exports.validObjectOrArray = void 0;
|
|
6
|
+
exports.loadBabelCompiler = exports.loadTypeScriptCompiler = exports.validateTsConfigPaths = exports.loadAutoCompilers = exports.validateConfig = exports.isCloudCapability = exports.isCucumberFeatureWithLineNumber = exports.removeLineNumbers = exports.validObjectOrArray = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const utils_1 = require("@wdio/utils");
|
|
7
9
|
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
8
10
|
const log = (0, logger_1.default)('@wdio/config:utils');
|
|
9
11
|
const validObjectOrArray = (object) => (Array.isArray(object) && object.length > 0) ||
|
|
@@ -50,7 +52,7 @@ function validateConfig(defaults, options, keysToKeep = []) {
|
|
|
50
52
|
* check if options is given
|
|
51
53
|
*/
|
|
52
54
|
if (typeof options[name] === 'undefined' && !expectedOption.default && expectedOption.required) {
|
|
53
|
-
throw new Error(`Required option "${name}" is missing`);
|
|
55
|
+
throw new Error(`Required option "${name.toString()}" is missing`);
|
|
54
56
|
}
|
|
55
57
|
if (typeof options[name] === 'undefined' && expectedOption.default) {
|
|
56
58
|
params[name] = expectedOption.default;
|
|
@@ -58,18 +60,18 @@ function validateConfig(defaults, options, keysToKeep = []) {
|
|
|
58
60
|
if (typeof options[name] !== 'undefined') {
|
|
59
61
|
const optValue = options[name];
|
|
60
62
|
if (typeof optValue !== expectedOption.type) {
|
|
61
|
-
throw new Error(`Expected option "${name}" to be type of ${expectedOption.type} but was ${typeof options[name]}`);
|
|
63
|
+
throw new Error(`Expected option "${name.toString()}" to be type of ${expectedOption.type} but was ${typeof options[name]}`);
|
|
62
64
|
}
|
|
63
65
|
if (typeof expectedOption.validate === 'function') {
|
|
64
66
|
try {
|
|
65
67
|
expectedOption.validate(optValue);
|
|
66
68
|
}
|
|
67
69
|
catch (e) {
|
|
68
|
-
throw new Error(`Type check for option "${name}" failed: ${e.message}`);
|
|
70
|
+
throw new Error(`Type check for option "${name.toString()}" failed: ${e.message}`);
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
if (typeof optValue === 'string' && expectedOption.match && !optValue.match(expectedOption.match)) {
|
|
72
|
-
throw new Error(`Option "${name}" doesn't match expected values: ${expectedOption.match}`);
|
|
74
|
+
throw new Error(`Option "${name.toString()}" doesn't match expected values: ${expectedOption.match}`);
|
|
73
75
|
}
|
|
74
76
|
params[name] = options[name];
|
|
75
77
|
}
|
|
@@ -92,8 +94,21 @@ function loadAutoCompilers(autoCompileConfig, requireService) {
|
|
|
92
94
|
loadBabelCompiler(autoCompileConfig.babelOpts, requireService)));
|
|
93
95
|
}
|
|
94
96
|
exports.loadAutoCompilers = loadAutoCompilers;
|
|
97
|
+
function validateTsConfigPaths(tsNodeOpts = {}) {
|
|
98
|
+
/**
|
|
99
|
+
* Checks tsconfig.json path, throws error if it doesn't exist
|
|
100
|
+
*/
|
|
101
|
+
if (tsNodeOpts === null || tsNodeOpts === void 0 ? void 0 : tsNodeOpts.project) {
|
|
102
|
+
const tsconfigPath = path_1.default.resolve(tsNodeOpts.project);
|
|
103
|
+
if (!(0, utils_1.canAccess)(tsconfigPath)) {
|
|
104
|
+
throw new Error('Provided tsconfig file path in wdio config is incorrect. Is it correctly set in wdio config ?');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.validateTsConfigPaths = validateTsConfigPaths;
|
|
95
109
|
function loadTypeScriptCompiler(tsNodeOpts = {}, tsConfigPathsOpts, requireService) {
|
|
96
110
|
try {
|
|
111
|
+
validateTsConfigPaths(tsNodeOpts);
|
|
97
112
|
requireService.resolve('ts-node');
|
|
98
113
|
requireService.require('ts-node').register(tsNodeOpts);
|
|
99
114
|
log.debug('Found \'ts-node\' package, auto-compiling TypeScript files');
|
|
@@ -105,6 +120,7 @@ function loadTypeScriptCompiler(tsNodeOpts = {}, tsConfigPathsOpts, requireServi
|
|
|
105
120
|
return true;
|
|
106
121
|
}
|
|
107
122
|
catch (err) {
|
|
123
|
+
log.error(`${err.message}`);
|
|
108
124
|
return false;
|
|
109
125
|
}
|
|
110
126
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/config",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.20.0",
|
|
4
4
|
"description": "A helper utility to parse and validate WebdriverIO options",
|
|
5
5
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-config",
|
|
@@ -24,9 +24,10 @@
|
|
|
24
24
|
"types": "./build/index.d.ts",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@wdio/logger": "7.19.0",
|
|
27
|
-
"@wdio/types": "7.
|
|
27
|
+
"@wdio/types": "7.20.0",
|
|
28
|
+
"@wdio/utils": "7.20.0",
|
|
28
29
|
"deepmerge": "^4.0.0",
|
|
29
|
-
"glob": "^
|
|
30
|
+
"glob": "^8.0.3"
|
|
30
31
|
},
|
|
31
32
|
"publishConfig": {
|
|
32
33
|
"access": "public"
|
|
@@ -35,5 +36,5 @@
|
|
|
35
36
|
"minimatch": "^5.0.0",
|
|
36
37
|
"tsconfig-paths": "^3.9.0"
|
|
37
38
|
},
|
|
38
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "b00976955d3901903fe8401d09ed10d8826d38b1"
|
|
39
40
|
}
|