@wdio/utils 8.0.9 → 8.0.10
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/initialiseServices.d.ts.map +1 -1
- package/build/initialiseServices.js +19 -14
- package/build/shim.d.ts +1 -1
- package/build/shim.d.ts.map +1 -1
- package/build/shim.js +1 -1
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +1 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialiseServices.d.ts","sourceRoot":"","sources":["../src/initialiseServices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAqFlE;;;;;;;GAOG;AACH,wBAAsB,yBAAyB,CAAE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,mBAAmB;;;
|
|
1
|
+
{"version":3,"file":"initialiseServices.d.ts","sourceRoot":"","sources":["../src/initialiseServices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAqFlE;;;;;;;GAOG;AACH,wBAAsB,yBAAyB,CAAE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,mBAAmB;;;GAmDvK;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CACzC,MAAM,EAAE,OAAO,CAAC,UAAU,EAC1B,IAAI,EAAE,YAAY,CAAC,mBAAmB,EACtC,qBAAqB,GAAE,MAAM,EAAO,GACrC,OAAO,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,CA+BrC"}
|
|
@@ -76,6 +76,7 @@ function sanitizeServiceArray(service) {
|
|
|
76
76
|
export async function initialiseLauncherService(config, caps) {
|
|
77
77
|
const ignoredWorkerServices = [];
|
|
78
78
|
const launcherServices = [];
|
|
79
|
+
let serviceLabelToBeInitialised = 'unknown';
|
|
79
80
|
try {
|
|
80
81
|
const services = await initialiseServices(config.services.map(sanitizeServiceArray));
|
|
81
82
|
for (const [service, serviceConfig, serviceName] of services) {
|
|
@@ -83,6 +84,7 @@ export async function initialiseLauncherService(config, caps) {
|
|
|
83
84
|
* add custom services as object or function
|
|
84
85
|
*/
|
|
85
86
|
if (typeof service === 'object' && !serviceName) {
|
|
87
|
+
serviceLabelToBeInitialised = 'object';
|
|
86
88
|
launcherServices.push(service);
|
|
87
89
|
continue;
|
|
88
90
|
}
|
|
@@ -91,16 +93,19 @@ export async function initialiseLauncherService(config, caps) {
|
|
|
91
93
|
*/
|
|
92
94
|
const Launcher = service.launcher;
|
|
93
95
|
if (typeof Launcher === 'function' && serviceName) {
|
|
96
|
+
serviceLabelToBeInitialised = `"${serviceName}"`;
|
|
94
97
|
launcherServices.push(new Launcher(serviceConfig, caps, config));
|
|
95
98
|
}
|
|
96
99
|
/**
|
|
97
100
|
* add class service from passed in class
|
|
98
101
|
*/
|
|
99
102
|
if (typeof service === 'function' && !serviceName) {
|
|
103
|
+
serviceLabelToBeInitialised = `"${service.constructor?.name || service.toString()}"`;
|
|
100
104
|
launcherServices.push(new service(serviceConfig, caps, config));
|
|
101
105
|
}
|
|
102
106
|
/**
|
|
103
|
-
* check if service has a default export
|
|
107
|
+
* check if service has a default export, if not we can later filter it out so the
|
|
108
|
+
* service module is not even loaded in the worker process
|
|
104
109
|
*/
|
|
105
110
|
if (serviceName &&
|
|
106
111
|
typeof service.default !== 'function' &&
|
|
@@ -110,10 +115,7 @@ export async function initialiseLauncherService(config, caps) {
|
|
|
110
115
|
}
|
|
111
116
|
}
|
|
112
117
|
catch (err) {
|
|
113
|
-
|
|
114
|
-
* don't break if service can't be initiated
|
|
115
|
-
*/
|
|
116
|
-
log.error(err);
|
|
118
|
+
throw new Error(`Failed to initilialise launcher service ${serviceLabelToBeInitialised}: ${err.stack}`);
|
|
117
119
|
}
|
|
118
120
|
return { ignoredWorkerServices, launcherServices };
|
|
119
121
|
}
|
|
@@ -126,29 +128,32 @@ export async function initialiseLauncherService(config, caps) {
|
|
|
126
128
|
* @return {Object[]} list if worker initiated worker services
|
|
127
129
|
*/
|
|
128
130
|
export async function initialiseWorkerService(config, caps, ignoredWorkerServices = []) {
|
|
131
|
+
let serviceLabelToBeInitialised = 'unknown';
|
|
132
|
+
const initialisedServices = [];
|
|
129
133
|
const workerServices = config.services
|
|
130
134
|
.map(sanitizeServiceArray)
|
|
131
135
|
.filter(([serviceName]) => !ignoredWorkerServices.includes(serviceName));
|
|
132
136
|
try {
|
|
133
137
|
const services = await initialiseServices(workerServices);
|
|
134
|
-
|
|
138
|
+
for (const [service, serviceConfig, serviceName] of services) {
|
|
135
139
|
/**
|
|
136
140
|
* add object service
|
|
137
141
|
*/
|
|
138
142
|
if (typeof service === 'object' && !serviceName) {
|
|
139
|
-
|
|
143
|
+
serviceLabelToBeInitialised = 'object';
|
|
144
|
+
initialisedServices.push(service);
|
|
145
|
+
continue;
|
|
140
146
|
}
|
|
141
147
|
const Service = service.default || service;
|
|
142
148
|
if (typeof Service === 'function') {
|
|
143
|
-
|
|
149
|
+
serviceLabelToBeInitialised = serviceName || Service.constructor?.name || Service.toString();
|
|
150
|
+
initialisedServices.push(new Service(serviceConfig, caps, config));
|
|
151
|
+
continue;
|
|
144
152
|
}
|
|
145
|
-
}
|
|
153
|
+
}
|
|
154
|
+
return initialisedServices;
|
|
146
155
|
}
|
|
147
156
|
catch (err) {
|
|
148
|
-
|
|
149
|
-
* don't break if service can't be initiated
|
|
150
|
-
*/
|
|
151
|
-
log.error(err);
|
|
152
|
-
return [];
|
|
157
|
+
throw new Error(`Failed to initilialise service ${serviceLabelToBeInitialised}: ${err.stack}`);
|
|
153
158
|
}
|
|
154
159
|
}
|
package/build/shim.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ declare global {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
declare let executeHooksWithArgs: <T>(hookName: string, hooks?: Function | Function[], args?: any[]) => Promise<(Error | T)[]>;
|
|
16
|
+
declare let executeHooksWithArgs: <T>(this: any, hookName: string, hooks?: Function | Function[], args?: any[]) => Promise<(Error | T)[]>;
|
|
17
17
|
/**
|
|
18
18
|
* wrap command to enable before and after command to be executed
|
|
19
19
|
* @param commandName name of the command (e.g. getTitle)
|
package/build/shim.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shim.d.ts","sourceRoot":"","sources":["../src/shim.ts"],"names":[],"mappings":"AAQA,UAAU,OAAO;IACb,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACnB;AAED,OAAO,CAAC,MAAM,CAAC;IACX,IAAI,WAAW,EAAE,GAAG,CAAA;CACvB;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM,CAAC;QACb,UAAU,MAAM;YACZ,MAAM,EAAE,GAAG,CAAA;YACX,WAAW,EAAE,GAAG,CAAA;SACnB;KACJ;CACJ;AAaD,QAAA,IAAI,oBAAoB,
|
|
1
|
+
{"version":3,"file":"shim.d.ts","sourceRoot":"","sources":["../src/shim.ts"],"names":[],"mappings":"AAQA,UAAU,OAAO;IACb,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACnB;AAED,OAAO,CAAC,MAAM,CAAC;IACX,IAAI,WAAW,EAAE,GAAG,CAAA;CACvB;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM,CAAC;QACb,UAAU,MAAM;YACZ,MAAM,EAAE,GAAG,CAAA;YACX,WAAW,EAAE,GAAG,CAAA;SACnB;KACJ;CACJ;AAaD,QAAA,IAAI,oBAAoB,YAAqD,GAAG,YAAY,MAAM,UAAS,QAAQ,GAAG,QAAQ,EAAE,SAAa,GAAG,EAAE,2BA6CjJ,CAAA;AAED;;;;GAIG;AACH,QAAA,IAAI,WAAW,mBAAwC,MAAM,MAAM,QAAQ,eAAa,GAAG,eAkL1F,CAAA;AAED;;;;;;;GAOG;AACH,iBAAe,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,GAAE,GAAG,EAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAmBzG;AAED,OAAO,EACH,oBAAoB,EACpB,WAAW,EACX,YAAY,GACf,CAAA"}
|
package/build/shim.js
CHANGED
|
@@ -28,7 +28,7 @@ let executeHooksWithArgs = async function executeHooksWithArgsShim(hookName, hoo
|
|
|
28
28
|
const hooksPromises = hooks.map((hook) => new Promise((resolve) => {
|
|
29
29
|
let result;
|
|
30
30
|
try {
|
|
31
|
-
result = hook.apply(
|
|
31
|
+
result = hook.apply(this, args);
|
|
32
32
|
}
|
|
33
33
|
catch (e) {
|
|
34
34
|
log.error(e.stack);
|
package/build/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAW,MAAM,aAAa,CAAA;AAMpD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,gBAAgB,EAAE;IAAE,sBAAsB,CAAC,EAAE;QAAE,KAAK,EAAE,GAAG,CAAA;KAAE,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,QAsCzH;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,UA+BrE;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAE,MAAM,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC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GG;AACH,wBAAgB,cAAc,CAAE,IAAI,EAAE,GAAG,EAAE,SAE1C;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,WAanC;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,UAAW,MAAM,YAWtC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,mCAAoD,CAAA"}
|
package/build/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/utils",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.10",
|
|
4
4
|
"description": "A WDIO helper utility to provide several utility functions used across the project.",
|
|
5
5
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-utils",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@wdio/logger": "8.0.0",
|
|
31
|
-
"@wdio/types": "8.0.
|
|
31
|
+
"@wdio/types": "8.0.10",
|
|
32
32
|
"import-meta-resolve": "^2.2.0",
|
|
33
33
|
"p-iteration": "^1.1.8"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "1c350a14144ecc5f1ebc598c385bae6aa80739c3"
|
|
39
39
|
}
|