@wdio/browser-runner 8.38.2 → 8.38.3
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocha.d.ts","sourceRoot":"","sources":["../../../src/browser/frameworks/mocha.ts"],"names":[],"mappings":"AA6BA,qBAAa,cAAe,SAAQ,WAAW;;;IAyB3C,MAAM,KAAK,kBAAkB,aAE5B;IAED,IAAI,IAAI,WAEP;IAED,iBAAiB;IAWjB,wBAAwB,CAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO;IAatE,GAAG;
|
|
1
|
+
{"version":3,"file":"mocha.d.ts","sourceRoot":"","sources":["../../../src/browser/frameworks/mocha.ts"],"names":[],"mappings":"AA6BA,qBAAa,cAAe,SAAQ,WAAW;;;IAyB3C,MAAM,KAAK,kBAAkB,aAE5B;IAED,IAAI,IAAI,WAEP;IAED,iBAAiB;IAWjB,wBAAwB,CAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO;IAatE,GAAG;CA8KZ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import safeStringify from 'safe-stringify';
|
|
2
2
|
import { setupEnv, formatMessage } from '@wdio/mocha-framework/common';
|
|
3
3
|
import { MESSAGE_TYPES } from '@wdio/types';
|
|
4
|
-
import { getCID } from '../utils.js';
|
|
4
|
+
import { getCID, filterTestArgument } from '../utils.js';
|
|
5
5
|
import { EVENTS, WDIO_EVENT_NAME } from '../../constants.js';
|
|
6
6
|
const startTime = Date.now();
|
|
7
7
|
if (!window.Mocha) {
|
|
@@ -172,14 +172,16 @@ export class MochaFramework extends HTMLElement {
|
|
|
172
172
|
return reject(new Error('"cid" query parameter is missing'));
|
|
173
173
|
}
|
|
174
174
|
this.#hookResolver.set(id, { resolve, reject });
|
|
175
|
+
/**
|
|
176
|
+
* filter large objects from args otherwise stringifying it to send it over
|
|
177
|
+
* to the Node.js process may result in slow performance
|
|
178
|
+
*/
|
|
175
179
|
args = args.map((arg) => {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const { type, title, body, async, sync, timedOut, pending, parent } = arg;
|
|
179
|
-
return { type, title, body, async, sync, timedOut, pending, parent, file: this.#spec };
|
|
180
|
+
if (typeof arg !== 'object') {
|
|
181
|
+
return arg;
|
|
180
182
|
}
|
|
181
183
|
// Check for error and convert error class to serializable Object.
|
|
182
|
-
if (
|
|
184
|
+
if ('error' in arg && arg.error instanceof Error) {
|
|
183
185
|
const errorObject = {
|
|
184
186
|
// Pull all enumerable properties, supporting properties on custom Errors
|
|
185
187
|
...arg.error,
|
|
@@ -197,7 +199,12 @@ export class MochaFramework extends HTMLElement {
|
|
|
197
199
|
error: errorObject
|
|
198
200
|
};
|
|
199
201
|
}
|
|
200
|
-
return
|
|
202
|
+
return {
|
|
203
|
+
...filterTestArgument(arg, this.#spec),
|
|
204
|
+
...('type' in arg && 'title' in arg ? { parent: arg.parent } : {}),
|
|
205
|
+
...('test' in arg && arg.test ? { test: filterTestArgument(arg.test, this.#spec) } : {}),
|
|
206
|
+
...('currentTest' in arg && arg.currentTest ? { currentTest: filterTestArgument(arg.currentTest, this.#spec) } : {})
|
|
207
|
+
};
|
|
201
208
|
});
|
|
202
209
|
import.meta.hot?.send(WDIO_EVENT_NAME, this.#hookTrigger({ name, id, cid, args }));
|
|
203
210
|
});
|
package/build/browser/utils.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
export declare function getCID(): string | undefined;
|
|
2
2
|
export declare const showPopupWarning: <T>(name: string, value: T, defaultValue?: T) => (...params: any[]) => T;
|
|
3
3
|
export declare function sanitizeConsoleArgs(args: unknown[]): any[];
|
|
4
|
+
/**
|
|
5
|
+
* Filter test argument to only contain relevant information
|
|
6
|
+
* @param arg hook parameter that may contain a test object from Mocha or Jasmine
|
|
7
|
+
* @param file file path of the test
|
|
8
|
+
* @returns test object with only relevant information
|
|
9
|
+
*/
|
|
10
|
+
export declare function filterTestArgument(arg: any, file: string): any;
|
|
4
11
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/browser/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,uBAYrB;AAED,eAAO,MAAM,gBAAgB,YAAa,MAAM,SAAS,CAAC,iBAAiB,CAAC,iBAAiB,GAAG,EAAE,MAYjG,CAAA;AAED,wBAAgB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/browser/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,uBAYrB;AAED,eAAO,MAAM,gBAAgB,YAAa,MAAM,SAAS,CAAC,iBAAiB,CAAC,iBAAiB,GAAG,EAAE,MAYjG,CAAA;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAyBlD;AAWD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,GAAG,CAY9D"}
|
package/build/browser/utils.js
CHANGED
|
@@ -46,3 +46,26 @@ export function sanitizeConsoleArgs(args) {
|
|
|
46
46
|
return arg;
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
+
const pick = (keys, obj) => {
|
|
50
|
+
return Object.fromEntries(Object.entries(obj)
|
|
51
|
+
.filter(([k]) => keys.includes(k)));
|
|
52
|
+
};
|
|
53
|
+
const RELEVANT_TEST_PROPS = ['type', 'title', 'body', 'async', 'sync', 'timedOut', 'pending', 'parent', 'test'];
|
|
54
|
+
/**
|
|
55
|
+
* Filter test argument to only contain relevant information
|
|
56
|
+
* @param arg hook parameter that may contain a test object from Mocha or Jasmine
|
|
57
|
+
* @param file file path of the test
|
|
58
|
+
* @returns test object with only relevant information
|
|
59
|
+
*/
|
|
60
|
+
export function filterTestArgument(arg, file) {
|
|
61
|
+
if (!arg) {
|
|
62
|
+
return arg;
|
|
63
|
+
}
|
|
64
|
+
const newArgs = pick(RELEVANT_TEST_PROPS, arg);
|
|
65
|
+
return {
|
|
66
|
+
...newArgs,
|
|
67
|
+
file: arg.file || file,
|
|
68
|
+
test: filterTestArgument(newArgs.test, file),
|
|
69
|
+
parent: filterTestArgument(newArgs.parent, file),
|
|
70
|
+
};
|
|
71
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/browser-runner",
|
|
3
|
-
"version": "8.38.
|
|
3
|
+
"version": "8.38.3",
|
|
4
4
|
"description": "A WebdriverIO runner to run unit tests tests in the browser.",
|
|
5
5
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-browser-runner",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "e32fa6ea6e406a71b27ab0ceae521172adcae501"
|
|
75
75
|
}
|