@wdio/browser-runner 8.5.4 → 8.5.6
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/browser/driver.d.ts.map +1 -1
- package/build/browser/driver.js +2 -2
- package/build/browser/frameworks/mocha.d.ts +6 -3
- package/build/browser/frameworks/mocha.d.ts.map +1 -1
- package/build/browser/frameworks/mocha.js +156 -21
- package/build/browser/setup.d.ts +2 -0
- package/build/browser/setup.d.ts.map +1 -1
- package/build/browser/setup.js +6 -9
- package/build/browser/utils.d.ts +2 -0
- package/build/browser/utils.d.ts.map +1 -0
- package/build/browser/utils.js +12 -0
- package/build/constants.d.ts +1 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +64 -0
- package/build/types.d.ts +2 -2
- package/build/types.d.ts.map +1 -1
- package/build/vite/constants.js +1 -1
- package/build/vite/plugins/testrunner.d.ts.map +1 -1
- package/build/vite/plugins/testrunner.js +3 -2
- package/build/vite/server.d.ts.map +1 -1
- package/build/vite/server.js +8 -2
- package/build/vite/utils.d.ts.map +1 -1
- package/build/vite/utils.js +20 -11
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/browser/driver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/browser/driver.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAC,OAAO,OAAO,WAAW;;IAG5B,MAAM,CAAC,UAAU,CACb,MAAM,EAAE,GAAG,EACX,QAAQ,EAAE,KAAK,EACf,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,EACjD,cAAc,EAAE,GAAG;CAoJ1B"}
|
package/build/browser/driver.js
CHANGED
|
@@ -2,14 +2,14 @@ import stringify from 'fast-safe-stringify';
|
|
|
2
2
|
import { commands } from 'virtual:wdio';
|
|
3
3
|
import { webdriverMonad, sessionEnvironmentDetector } from '@wdio/utils';
|
|
4
4
|
import { getEnvironmentVars } from 'webdriver';
|
|
5
|
+
import { getCID } from './utils.js';
|
|
5
6
|
import { MESSAGE_TYPES } from '../constants.js';
|
|
6
7
|
const COMMAND_TIMEOUT = 30 * 1000; // 30s
|
|
7
8
|
const CONSOLE_METHODS = ['log', 'info', 'warn', 'error', 'debug'];
|
|
8
9
|
export default class ProxyDriver {
|
|
9
10
|
static #commandMessages = new Map();
|
|
10
11
|
static newSession(params, modifier, userPrototype, commandWrapper) {
|
|
11
|
-
const
|
|
12
|
-
const cid = urlParamString.get('cid');
|
|
12
|
+
const cid = getCID();
|
|
13
13
|
if (!cid) {
|
|
14
14
|
throw new Error('"cid" query parameter is missing');
|
|
15
15
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
export declare class MochaFramework {
|
|
1
|
+
export declare class MochaFramework extends HTMLElement {
|
|
2
2
|
#private;
|
|
3
|
-
constructor(
|
|
4
|
-
|
|
3
|
+
constructor();
|
|
4
|
+
static get observedAttributes(): string[];
|
|
5
|
+
connectedCallback(): void;
|
|
6
|
+
attributeChangedCallback(name: string, oldValue: unknown, newValue: unknown): void;
|
|
7
|
+
run(socket: WebSocket): Promise<void>;
|
|
5
8
|
}
|
|
6
9
|
//# sourceMappingURL=mocha.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocha.d.ts","sourceRoot":"","sources":["../../../src/browser/frameworks/mocha.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mocha.d.ts","sourceRoot":"","sources":["../../../src/browser/frameworks/mocha.ts"],"names":[],"mappings":"AAgCA,qBAAa,cAAe,SAAQ,WAAW;;;IAuB3C,MAAM,KAAK,kBAAkB,aAE5B;IAED,iBAAiB;IAWjB,wBAAwB,CAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO;IAatE,GAAG,CAAE,MAAM,EAAE,SAAS;CAkG/B"}
|
|
@@ -1,16 +1,78 @@
|
|
|
1
1
|
import stringify from 'fast-safe-stringify';
|
|
2
2
|
import { setupEnv, formatMessage } from '@wdio/mocha-framework/common';
|
|
3
|
+
import { getCID } from '../utils.js';
|
|
3
4
|
import { MESSAGE_TYPES, EVENTS } from '../../constants.js';
|
|
4
5
|
const startTime = Date.now();
|
|
5
|
-
|
|
6
|
+
if (!window.Mocha) {
|
|
7
|
+
throw new Error('Can\'t find Mocha attached to the `window` scope, was it installed? Run `npm install mocha` and run again!');
|
|
8
|
+
}
|
|
9
|
+
const BaseReporter = window.Mocha.reporters.html;
|
|
10
|
+
class HTMLReporter extends BaseReporter {
|
|
11
|
+
constructor(runner, options) {
|
|
12
|
+
/**
|
|
13
|
+
* this is a little hack to ensure Mocha attaches the HTML reporter
|
|
14
|
+
* to the element within the Shadow DOM
|
|
15
|
+
*/
|
|
16
|
+
const getElementById = document.getElementById.bind(document);
|
|
17
|
+
document.getElementById = () => document.querySelector('mocha-framework')?.shadowRoot?.querySelector('#mocha');
|
|
18
|
+
super(runner, options);
|
|
19
|
+
document.getElementById = getElementById;
|
|
20
|
+
}
|
|
21
|
+
addCodeToggle() { }
|
|
22
|
+
}
|
|
23
|
+
//examples/wdio/node_modules/uuid/dist/esm-browser/index.js
|
|
24
|
+
export class MochaFramework extends HTMLElement {
|
|
25
|
+
#root;
|
|
26
|
+
#spec;
|
|
6
27
|
#socket;
|
|
7
28
|
#hookResolver = new Map();
|
|
8
29
|
#runnerEvents = [];
|
|
9
|
-
|
|
30
|
+
#isMinified = false;
|
|
31
|
+
constructor() {
|
|
32
|
+
super();
|
|
33
|
+
this.#root = this.attachShadow({ mode: 'open' });
|
|
34
|
+
this.#spec = this.getAttribute('spec');
|
|
35
|
+
if (!this.#spec) {
|
|
36
|
+
throw new Error('"spec" attribute required but not set');
|
|
37
|
+
}
|
|
38
|
+
mocha.setup({
|
|
39
|
+
...window.__wdioEnv__.args,
|
|
40
|
+
reporter: HTMLReporter
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
static get observedAttributes() {
|
|
44
|
+
return ['minified'];
|
|
45
|
+
}
|
|
46
|
+
connectedCallback() {
|
|
47
|
+
this.#root.appendChild(template.content.cloneNode(true));
|
|
48
|
+
this.#root.querySelector('.btnCollapseExpand')?.addEventListener('click', () => {
|
|
49
|
+
if (this.#isMinified) {
|
|
50
|
+
this.shadowRoot.host.removeAttribute('minified');
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.shadowRoot.host.setAttribute('minified', 'minified');
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
58
|
+
if (name === 'minified') {
|
|
59
|
+
this.#isMinified = typeof newValue === 'string';
|
|
60
|
+
const reporterElem = this.#root.querySelector('.reporter');
|
|
61
|
+
if (reporterElem) {
|
|
62
|
+
reporterElem.className = this.#isMinified ? 'reporter minified' : 'reporter';
|
|
63
|
+
}
|
|
64
|
+
document.body.style.width = `calc(100% - ${this.#isMinified ? '65px' : '500px'})`;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
async run(socket) {
|
|
68
|
+
/**
|
|
69
|
+
* import test case (order is important here)
|
|
70
|
+
*/
|
|
71
|
+
const file = this.#spec;
|
|
72
|
+
await import(file);
|
|
10
73
|
this.#socket = socket;
|
|
11
74
|
socket.addEventListener('message', this.#handleSocketMessage.bind(this));
|
|
12
|
-
const
|
|
13
|
-
const cid = urlParamString.get('cid');
|
|
75
|
+
const cid = getCID();
|
|
14
76
|
if (!cid) {
|
|
15
77
|
throw new Error('"cid" query parameter is missing');
|
|
16
78
|
}
|
|
@@ -23,25 +85,23 @@ export class MochaFramework {
|
|
|
23
85
|
before(function () {
|
|
24
86
|
self.#getHook('beforeSuite')({
|
|
25
87
|
...this.test?.parent?.suites[0],
|
|
26
|
-
file
|
|
88
|
+
file,
|
|
27
89
|
});
|
|
28
90
|
});
|
|
29
91
|
after(function () {
|
|
30
92
|
self.#getHook('afterSuite')({
|
|
31
93
|
...this.test?.parent?.suites[0],
|
|
32
|
-
file
|
|
94
|
+
file,
|
|
33
95
|
duration: Date.now() - startTime
|
|
34
96
|
});
|
|
35
97
|
});
|
|
36
|
-
}
|
|
37
|
-
run() {
|
|
38
98
|
const runner = mocha.run(this.#onFinish.bind(this));
|
|
39
99
|
Object.entries(EVENTS).map(([mochaEvent, wdioEvent]) => runner.on(mochaEvent, (payload) => {
|
|
40
100
|
this.#runnerEvents.push(formatMessage({ type: wdioEvent, payload, err: payload.err }));
|
|
41
101
|
}));
|
|
42
102
|
}
|
|
43
103
|
async #onFinish(failures) {
|
|
44
|
-
await this.#getHook('after')(failures, window.__wdioEnv__.capabilities, [
|
|
104
|
+
await this.#getHook('after')(failures, window.__wdioEnv__.capabilities, [this.#spec]);
|
|
45
105
|
/**
|
|
46
106
|
* propagate results to browser so it can be picked up by the runner
|
|
47
107
|
*/
|
|
@@ -75,13 +135,12 @@ export class MochaFramework {
|
|
|
75
135
|
#getHook(name) {
|
|
76
136
|
return (...args) => new Promise((resolve, reject) => {
|
|
77
137
|
const id = (this.#hookResolver.size + 1).toString();
|
|
78
|
-
const
|
|
79
|
-
const cid = urlParamString.get('cid');
|
|
138
|
+
const cid = getCID();
|
|
80
139
|
if (!cid) {
|
|
81
140
|
return reject(new Error('"cid" query parameter is missing'));
|
|
82
141
|
}
|
|
83
142
|
this.#hookResolver.set(id.toString(), { resolve, reject });
|
|
84
|
-
this.#socket
|
|
143
|
+
this.#socket?.send(stringify(this.#hookTrigger({ name, id, cid, args })));
|
|
85
144
|
});
|
|
86
145
|
}
|
|
87
146
|
#hookTrigger(value) {
|
|
@@ -91,12 +150,88 @@ export class MochaFramework {
|
|
|
91
150
|
};
|
|
92
151
|
}
|
|
93
152
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
153
|
+
const template = document.createElement('template');
|
|
154
|
+
template.innerHTML = /*html*/ `
|
|
155
|
+
<style>
|
|
156
|
+
@import "/node_modules/mocha/mocha.css";
|
|
157
|
+
|
|
158
|
+
.reporter {
|
|
159
|
+
transition: width .3s;
|
|
160
|
+
box-shadow: -5px 0px 10px #aaa;
|
|
161
|
+
position: absolute;
|
|
162
|
+
top: 0;
|
|
163
|
+
right: 0;
|
|
164
|
+
width: 500px;
|
|
165
|
+
height: 100%;
|
|
166
|
+
margin: 0;
|
|
167
|
+
color: var(--mocha-color);
|
|
168
|
+
background-color: var(--mocha-bg-color);
|
|
169
|
+
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNjRweCIgaGVpZ2h0PSI2NHB4IiB2aWV3Qm94PSIwIDAgNjQgNjQiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8dGl0bGU+TG9nbyBSZWd1bGFyPC90aXRsZT4KICAgIDxnIGlkPSJMb2dvLVJlZ3VsYXIiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUiIGZpbGw9IiNFQTU5MDYiIHg9IjAiIHk9IjAiIHdpZHRoPSI2NCIgaGVpZ2h0PSI2NCIgcng9IjUiPjwvcmVjdD4KICAgICAgICA8cGF0aCBkPSJNOCwxNiBMOCw0OCBMNiw0OCBMNiwxNiBMOCwxNiBaIE00MywxNiBDNTEuODM2NTU2LDE2IDU5LDIzLjE2MzQ0NCA1OSwzMiBDNTksNDAuODM2NTU2IDUxLjgzNjU1Niw0OCA0Myw0OCBDMzQuMTYzNDQ0LDQ4IDI3LDQwLjgzNjU1NiAyNywzMiBDMjcsMjMuMTYzNDQ0IDM0LjE2MzQ0NCwxNiA0MywxNiBaIE0yNywxNiBMMTQuMTA2LDQ3Ljk5OTIwNzggTDExLjk5OSw0Ny45OTkyMDc4IEwyNC44OTQsMTYgTDI3LDE2IFogTTQzLDE4IEMzNS4yNjgwMTM1LDE4IDI5LDI0LjI2ODAxMzUgMjksMzIgQzI5LDM5LjczMTk4NjUgMzUuMjY4MDEzNSw0NiA0Myw0NiBDNTAuNzMxOTg2NSw0NiA1NywzOS43MzE5ODY1IDU3LDMyIEM1NywyNC4yNjgwMTM1IDUwLjczMTk4NjUsMTggNDMsMTggWiIgaWQ9IkNvbWJpbmVkLVNoYXBlIiBmaWxsPSIjRkZGRkZGIj48L3BhdGg+CiAgICA8L2c+Cjwvc3ZnPg==);
|
|
170
|
+
background-repeat: no-repeat;
|
|
171
|
+
background-size: 30px;
|
|
172
|
+
background-position: 15px 20px;
|
|
173
|
+
}
|
|
174
|
+
.reporter.minified {
|
|
175
|
+
width: 65px;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
#mocha {
|
|
179
|
+
margin: 0;
|
|
180
|
+
}
|
|
181
|
+
ul#mocha-report {
|
|
182
|
+
transition: opacity .3s;
|
|
183
|
+
opacity: 1;
|
|
184
|
+
padding: 50px 15px 0 0;
|
|
185
|
+
}
|
|
186
|
+
.minified ul#mocha-report {
|
|
187
|
+
opacity: 0;
|
|
188
|
+
}
|
|
189
|
+
.minified .progress {
|
|
190
|
+
display: block;
|
|
191
|
+
float: none;
|
|
192
|
+
}
|
|
193
|
+
.minified #mocha-stats {
|
|
194
|
+
width: 50px;
|
|
195
|
+
padding-top: 60px;
|
|
196
|
+
}
|
|
197
|
+
.minified #mocha-stats li {
|
|
198
|
+
font-size: .9em;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
@keyframes fadeOutIn {
|
|
202
|
+
0% { opacity: 1; }
|
|
203
|
+
20% { opacity: 0; }
|
|
204
|
+
100% { opacity: 1; }
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.btnCollapseExpand {
|
|
208
|
+
display: block;
|
|
209
|
+
width: 50px;
|
|
210
|
+
position: absolute;
|
|
211
|
+
height: 50px;
|
|
212
|
+
bottom: 0;
|
|
213
|
+
right: 0;
|
|
214
|
+
transition: transform .3s;
|
|
215
|
+
transform: scale(1) translateX(-434px);
|
|
216
|
+
margin: 10px 8px;
|
|
217
|
+
background: transparent;
|
|
218
|
+
border: 0;
|
|
219
|
+
cursor: pointer;
|
|
220
|
+
}
|
|
221
|
+
.minified .btnCollapseExpand {
|
|
222
|
+
transform: scale(-1) translateX(0px);
|
|
223
|
+
animation-name: fadeOutIn;
|
|
224
|
+
animation-duration: .3s;
|
|
225
|
+
}
|
|
226
|
+
</style>
|
|
227
|
+
<div class="reporter">
|
|
228
|
+
<div id="mocha"></div>
|
|
229
|
+
<button class="btnCollapseExpand">
|
|
230
|
+
<svg width="50" height="40" viewBox="2 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
|
231
|
+
<path fill="#fff" d="M13.11 29.113c7.243 0 13.113-5.871 13.113-13.113S20.353 2.887 13.11 2.887C5.868 2.887-.003 8.758-.003 16S5.868 29.113 13.11 29.113zm0-25.177c6.652 0 12.064 5.412 12.064 12.064S19.762 28.064 13.11 28.064C6.457 28.064 1.046 22.652 1.046 16S6.457 3.936 13.11 3.936z"/>
|
|
232
|
+
<path fill="#fff" d="m13.906 21.637.742.742L21.026 16l-6.378-6.379-.742.742 5.112 5.112H6.291v1.049h12.727z"/>
|
|
233
|
+
</svg>
|
|
234
|
+
</button>
|
|
235
|
+
</div>
|
|
236
|
+
`;
|
|
237
|
+
customElements.define('mocha-framework', MochaFramework);
|
package/build/browser/setup.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/browser/setup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/browser/setup.ts"],"names":[],"mappings":"AAMA,OAAO,uBAAuB,CAAA;AAG9B,KAAK,cAAc,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC,CAAA;AAC9D,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,KAAK,CAAC,EAAE,GAAG,CAAA;QACX,cAAc,EAAE,cAAc,EAAE,CAAA;QAChC,YAAY,EAAE,MAAM,CAAA;QACpB,gBAAgB,EAAE,MAAM,CAAA;QACxB,cAAc,EAAE,GAAG,EAAE,CAAA;QACrB,cAAc,EAAE,SAAS,CAAA;QACzB,sBAAsB,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;QAC1C,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAC7C;CACJ;AAOD,eAAO,MAAM,MAAM,WAA+C,CAAA;AAClE,eAAO,MAAM,cAAc,oBAGzB,CAAA"}
|
package/build/browser/setup.js
CHANGED
|
@@ -2,7 +2,7 @@ import { automationProtocolPath } from 'virtual:wdio';
|
|
|
2
2
|
import { expect } from 'expect-webdriverio';
|
|
3
3
|
import { remote } from 'webdriverio';
|
|
4
4
|
import { _setGlobal } from '@wdio/globals';
|
|
5
|
-
import
|
|
5
|
+
import './frameworks/mocha.js';
|
|
6
6
|
/**
|
|
7
7
|
* create connection to Vite server
|
|
8
8
|
*/
|
|
@@ -25,11 +25,8 @@ _setGlobal('driver', browser, window.__wdioEnv__.injectGlobals);
|
|
|
25
25
|
_setGlobal('expect', expect, window.__wdioEnv__.injectGlobals);
|
|
26
26
|
_setGlobal('$', browser.$.bind(browser), window.__wdioEnv__.injectGlobals);
|
|
27
27
|
_setGlobal('$$', browser.$$.bind(browser), window.__wdioEnv__.injectGlobals);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
await import(window.__wdioSpec__);
|
|
34
|
-
framework.run();
|
|
35
|
-
});
|
|
28
|
+
const mochaFramework = document.querySelector('mocha-framework');
|
|
29
|
+
if (mochaFramework) {
|
|
30
|
+
await connectPromise;
|
|
31
|
+
mochaFramework.run(socket);
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/browser/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,uBAYrB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function getCID() {
|
|
2
|
+
const urlParamString = new URLSearchParams(window.location.search);
|
|
3
|
+
return (
|
|
4
|
+
// initial request contains cid as query parameter
|
|
5
|
+
urlParamString.get('cid') ||
|
|
6
|
+
// if not provided check for document cookie, set by `@wdio/runner` package
|
|
7
|
+
(document.cookie.split(';') || [])
|
|
8
|
+
.find((c) => c.includes('WDIO_CID'))
|
|
9
|
+
?.trim()
|
|
10
|
+
.split('=')
|
|
11
|
+
.pop());
|
|
12
|
+
}
|
package/build/constants.d.ts
CHANGED
|
@@ -34,4 +34,5 @@ export declare const COVERAGE_FACTORS: readonly ["lines", "functions", "branches
|
|
|
34
34
|
export declare const DEFAULT_COVERAGE_REPORTS: (keyof ReportOptions)[];
|
|
35
35
|
export declare const GLOBAL_TRESHOLD_REPORTING = "ERROR: Coverage for %s (%s%) does not meet global threshold (%s%)";
|
|
36
36
|
export declare const FILE_TRESHOLD_REPORTING = "ERROR: Coverage for %s (%s%) does not meet threshold (%s%) for %s";
|
|
37
|
+
export declare const MOCHA_VARIABELS = ":root {\n --mocha-color: #000;\n --mocha-bg-color: #fff;\n --mocha-pass-icon-color: #00d6b2;\n --mocha-pass-color: #fff;\n --mocha-pass-shadow-color: rgba(0, 0, 0, .2);\n --mocha-pass-mediump-color: #c09853;\n --mocha-pass-slow-color: #b94a48;\n --mocha-test-pending-color: #0b97c4;\n --mocha-test-pending-icon-color: #0b97c4;\n --mocha-test-fail-color: #c00;\n --mocha-test-fail-icon-color: #c00;\n --mocha-test-fail-pre-color: #000;\n --mocha-test-fail-pre-error-color: #c00;\n --mocha-test-html-error-color: #000;\n --mocha-box-shadow-color: #eee;\n --mocha-box-bottom-color: #ddd;\n --mocha-test-replay-color: #000;\n --mocha-test-replay-bg-color: #eee;\n --mocha-stats-color: #888;\n --mocha-stats-em-color: #000;\n --mocha-stats-hover-color: #eee;\n --mocha-error-color: #c00;\n\n --mocha-code-comment: #ddd;\n --mocha-code-init: #2f6fad;\n --mocha-code-string: #5890ad;\n --mocha-code-keyword: #8a6343;\n --mocha-code-number: #2f6fad;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --mocha-color: #fff;\n --mocha-bg-color: #222;\n --mocha-pass-icon-color: #00d6b2;\n --mocha-pass-color: #222;\n --mocha-pass-shadow-color: rgba(255, 255, 255, .2);\n --mocha-pass-mediump-color: #f1be67;\n --mocha-pass-slow-color: #f49896;\n --mocha-test-pending-color: #0b97c4;\n --mocha-test-pending-icon-color: #0b97c4;\n --mocha-test-fail-color: #f44;\n --mocha-test-fail-icon-color: #f44;\n --mocha-test-fail-pre-color: #fff;\n --mocha-test-fail-pre-error-color: #f44;\n --mocha-test-html-error-color: #fff;\n --mocha-box-shadow-color: #444;\n --mocha-box-bottom-color: #555;\n --mocha-test-replay-color: #fff;\n --mocha-test-replay-bg-color: #444;\n --mocha-stats-color: #aaa;\n --mocha-stats-em-color: #fff;\n --mocha-stats-hover-color: #444;\n --mocha-error-color: #f44;\n\n --mocha-code-comment: #ddd;\n --mocha-code-init: #9cc7f1;\n --mocha-code-string: #80d4ff;\n --mocha-code-keyword: #e3a470;\n --mocha-code-number: #4ca7ff;\n }\n}\n";
|
|
37
38
|
//# sourceMappingURL=constants.d.ts.map
|
package/build/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,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,CAAA;AAEV,eAAO,MAAM,uBAAuB,wFAAsF,CAAA;AAE1H,oBAAY,aAAa;IACrB,cAAc,IAAI;IAClB,qBAAqB,IAAA;IACrB,sBAAsB,IAAA;IACtB,kBAAkB,IAAA;IAClB,iBAAiB,IAAA;IACjB,WAAW,IAAA;IACX,YAAY,IAAA;CACf;AAED,eAAO,MAAM,eAAe,UAAS,CAAA;AACrC,eAAO,MAAM,uBAAuB,UAAoF,CAAA;AACxH,eAAO,MAAM,yBAAyB,aAAa,CAAA;AACnD,eAAO,MAAM,gBAAgB,OAAO,CAAA;AACpC,eAAO,MAAM,sBAAsB,cAAc,CAAA;AACjD,eAAO,MAAM,gBAAgB,iBAAiB,CAAA;AAC9C,eAAO,MAAM,gBAAgB,2DAA4D,CAAA;AACzF,eAAO,MAAM,wBAAwB,EAAE,CAAC,MAAM,aAAa,CAAC,EAAiD,CAAA;AAC7G,eAAO,MAAM,yBAAyB,sEAAsE,CAAA;AAC5G,eAAO,MAAM,uBAAuB,sEAAsE,CAAA;AAE1G,eAAO,MAAM,eAAe,irEA+D3B,CAAA"}
|
package/build/constants.js
CHANGED
|
@@ -33,3 +33,67 @@ export const COVERAGE_FACTORS = ['lines', 'functions', 'branches', 'statements']
|
|
|
33
33
|
export const DEFAULT_COVERAGE_REPORTS = ['text', 'html', 'clover', SUMMARY_REPORTER];
|
|
34
34
|
export const GLOBAL_TRESHOLD_REPORTING = 'ERROR: Coverage for %s (%s%) does not meet global threshold (%s%)';
|
|
35
35
|
export const FILE_TRESHOLD_REPORTING = 'ERROR: Coverage for %s (%s%) does not meet threshold (%s%) for %s';
|
|
36
|
+
export const MOCHA_VARIABELS = /*css*/ `:root {
|
|
37
|
+
--mocha-color: #000;
|
|
38
|
+
--mocha-bg-color: #fff;
|
|
39
|
+
--mocha-pass-icon-color: #00d6b2;
|
|
40
|
+
--mocha-pass-color: #fff;
|
|
41
|
+
--mocha-pass-shadow-color: rgba(0, 0, 0, .2);
|
|
42
|
+
--mocha-pass-mediump-color: #c09853;
|
|
43
|
+
--mocha-pass-slow-color: #b94a48;
|
|
44
|
+
--mocha-test-pending-color: #0b97c4;
|
|
45
|
+
--mocha-test-pending-icon-color: #0b97c4;
|
|
46
|
+
--mocha-test-fail-color: #c00;
|
|
47
|
+
--mocha-test-fail-icon-color: #c00;
|
|
48
|
+
--mocha-test-fail-pre-color: #000;
|
|
49
|
+
--mocha-test-fail-pre-error-color: #c00;
|
|
50
|
+
--mocha-test-html-error-color: #000;
|
|
51
|
+
--mocha-box-shadow-color: #eee;
|
|
52
|
+
--mocha-box-bottom-color: #ddd;
|
|
53
|
+
--mocha-test-replay-color: #000;
|
|
54
|
+
--mocha-test-replay-bg-color: #eee;
|
|
55
|
+
--mocha-stats-color: #888;
|
|
56
|
+
--mocha-stats-em-color: #000;
|
|
57
|
+
--mocha-stats-hover-color: #eee;
|
|
58
|
+
--mocha-error-color: #c00;
|
|
59
|
+
|
|
60
|
+
--mocha-code-comment: #ddd;
|
|
61
|
+
--mocha-code-init: #2f6fad;
|
|
62
|
+
--mocha-code-string: #5890ad;
|
|
63
|
+
--mocha-code-keyword: #8a6343;
|
|
64
|
+
--mocha-code-number: #2f6fad;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@media (prefers-color-scheme: dark) {
|
|
68
|
+
:root {
|
|
69
|
+
--mocha-color: #fff;
|
|
70
|
+
--mocha-bg-color: #222;
|
|
71
|
+
--mocha-pass-icon-color: #00d6b2;
|
|
72
|
+
--mocha-pass-color: #222;
|
|
73
|
+
--mocha-pass-shadow-color: rgba(255, 255, 255, .2);
|
|
74
|
+
--mocha-pass-mediump-color: #f1be67;
|
|
75
|
+
--mocha-pass-slow-color: #f49896;
|
|
76
|
+
--mocha-test-pending-color: #0b97c4;
|
|
77
|
+
--mocha-test-pending-icon-color: #0b97c4;
|
|
78
|
+
--mocha-test-fail-color: #f44;
|
|
79
|
+
--mocha-test-fail-icon-color: #f44;
|
|
80
|
+
--mocha-test-fail-pre-color: #fff;
|
|
81
|
+
--mocha-test-fail-pre-error-color: #f44;
|
|
82
|
+
--mocha-test-html-error-color: #fff;
|
|
83
|
+
--mocha-box-shadow-color: #444;
|
|
84
|
+
--mocha-box-bottom-color: #555;
|
|
85
|
+
--mocha-test-replay-color: #fff;
|
|
86
|
+
--mocha-test-replay-bg-color: #444;
|
|
87
|
+
--mocha-stats-color: #aaa;
|
|
88
|
+
--mocha-stats-em-color: #fff;
|
|
89
|
+
--mocha-stats-hover-color: #444;
|
|
90
|
+
--mocha-error-color: #f44;
|
|
91
|
+
|
|
92
|
+
--mocha-code-comment: #ddd;
|
|
93
|
+
--mocha-code-init: #9cc7f1;
|
|
94
|
+
--mocha-code-string: #80d4ff;
|
|
95
|
+
--mocha-code-keyword: #e3a470;
|
|
96
|
+
--mocha-code-number: #4ca7ff;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
`;
|
package/build/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InlineConfig } from 'vite';
|
|
1
|
+
import type { ConfigEnv, InlineConfig } from 'vite';
|
|
2
2
|
import type { Workers, Capabilities, Options } from '@wdio/types';
|
|
3
3
|
import type { MochaOpts } from '@wdio/mocha-framework';
|
|
4
4
|
import type { IstanbulPluginOptions } from 'vite-plugin-istanbul';
|
|
@@ -82,7 +82,7 @@ export interface BrowserRunnerOptions {
|
|
|
82
82
|
/**
|
|
83
83
|
* Vite configuration to overwrite the preset
|
|
84
84
|
*/
|
|
85
|
-
viteConfig?: string | InlineConfig;
|
|
85
|
+
viteConfig?: string | InlineConfig | ((env: ConfigEnv) => InlineConfig | Promise<InlineConfig>);
|
|
86
86
|
/**
|
|
87
87
|
* Run tests in headless mode
|
|
88
88
|
* @default false // true in CI environment
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAA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VITE_CONFIG = {
|
|
|
36
36
|
'expect', 'jest-matcher-utils', 'serialize-error', 'minimatch', 'css-shorthand-properties',
|
|
37
37
|
'lodash.merge', 'lodash.zip', 'lodash.clonedeep', 'lodash.pickby', 'lodash.flattendeep',
|
|
38
38
|
'aria-query', 'grapheme-splitter', 'css-value', 'rgb2hex', 'p-iteration', 'fast-safe-stringify',
|
|
39
|
-
'deepmerge-ts'
|
|
39
|
+
'deepmerge-ts', 'jest-util'
|
|
40
40
|
],
|
|
41
41
|
esbuildOptions: {
|
|
42
42
|
logLevel: 'silent',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testrunner.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/testrunner.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AA0ClC,wBAAgB,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,oBAAoB,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"testrunner.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/testrunner.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AA0ClC,wBAAgB,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,oBAAoB,GAAG,MAAM,EAAE,CAoH9E"}
|
|
@@ -88,10 +88,11 @@ export function testrunner(options) {
|
|
|
88
88
|
if (!req.originalUrl) {
|
|
89
89
|
return next();
|
|
90
90
|
}
|
|
91
|
+
const cookies = ((req.headers.cookie && req.headers.cookie.split(';')) || []).map((c) => c.trim());
|
|
91
92
|
const urlParsed = url.parse(req.originalUrl);
|
|
92
93
|
const urlParamString = new URLSearchParams(urlParsed.query || '');
|
|
93
|
-
const cid = urlParamString.get('cid');
|
|
94
|
-
const spec = urlParamString.get('spec');
|
|
94
|
+
const cid = urlParamString.get('cid') || cookies.find((c) => c.includes('WDIO_CID'))?.split('=').pop();
|
|
95
|
+
const spec = urlParamString.get('spec') || cookies.find((c) => c.includes('WDIO_SPEC'))?.split('=').pop();
|
|
95
96
|
if (!cid || !SESSIONS.has(cid)) {
|
|
96
97
|
log.error(`No environment found for ${cid || 'non determined environment'}`);
|
|
97
98
|
return next();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/vite/server.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAM1C,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAA;AAGpC,OAAO,KAAK,EAAiB,YAAY,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/vite/server.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAM1C,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAA;AAGpC,OAAO,KAAK,EAAiB,YAAY,EAAa,MAAM,MAAM,CAAA;AAGlE,OAAO,KAAK,EAAY,OAAO,EAAE,MAAM,aAAa,CAAA;AAQpD,OAAO,KAAK,EACM,gBAAgB,EAEjC,MAAM,YAAY,CAAA;AAgBnB,qBAAa,UAAW,SAAQ,YAAY;;IAUxC,IAAI,YAAY,gCAEf;IAED,IAAI,MAAM,0BAET;gBAEY,OAAO,EAAE,WAAW,CAAC,oBAAoB,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU;IAyB5E,KAAK;IAsDL,KAAK;IAkJX,OAAO,CAAC,cAAc;IAetB,WAAW,CAAE,MAAM,EAAE,gBAAgB;CAUxC"}
|
package/build/vite/server.js
CHANGED
|
@@ -17,6 +17,10 @@ import { MESSAGE_TYPES, DEFAULT_INCLUDE, DEFAULT_FILE_EXTENSIONS } from '../cons
|
|
|
17
17
|
import { BROWSER_POOL, SESSIONS } from '../constants.js';
|
|
18
18
|
const log = logger('@wdio/browser-runner:ViteServer');
|
|
19
19
|
const HOOK_TIMEOUT = 15 * 1000;
|
|
20
|
+
const DEFAULT_CONFIG_ENV = {
|
|
21
|
+
command: 'serve',
|
|
22
|
+
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development'
|
|
23
|
+
};
|
|
20
24
|
export class ViteServer extends EventEmitter {
|
|
21
25
|
#pendingHooks = new Map();
|
|
22
26
|
#connections = new Set();
|
|
@@ -85,7 +89,9 @@ export class ViteServer extends EventEmitter {
|
|
|
85
89
|
if (this.#options.viteConfig) {
|
|
86
90
|
const configToMerge = typeof this.#options.viteConfig === 'string'
|
|
87
91
|
? (await import(path.resolve(this.#config.rootDir || process.cwd(), this.#options.viteConfig))).default
|
|
88
|
-
: this.#options.viteConfig
|
|
92
|
+
: typeof this.#options.viteConfig === 'function'
|
|
93
|
+
? await this.#options.viteConfig(DEFAULT_CONFIG_ENV)
|
|
94
|
+
: this.#options.viteConfig;
|
|
89
95
|
this.#viteConfig = deepmerge(this.#viteConfig, configToMerge);
|
|
90
96
|
}
|
|
91
97
|
/**
|
|
@@ -140,7 +146,7 @@ export class ViteServer extends EventEmitter {
|
|
|
140
146
|
};
|
|
141
147
|
}
|
|
142
148
|
#handleConsole(message) {
|
|
143
|
-
const isWDIOLog = Boolean(typeof message.args[0] === 'string' && message.args[0].startsWith('[WDIO]'));
|
|
149
|
+
const isWDIOLog = Boolean(typeof message.args[0] === 'string' && message.args[0].startsWith('[WDIO]') && message.type !== 'error');
|
|
144
150
|
if (message.name !== 'consoleEvent' || isWDIOLog) {
|
|
145
151
|
return;
|
|
146
152
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/vite/utils.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/vite/utils.ts"],"names":[],"mappings":";AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAI/D,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,oBAAoB,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,oBAAc,mBAqFpI;AAED,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,CAAC,EAAE,MAAM,gBAa7E;AAED,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAY7D;AAED,wBAAsB,qBAAqB,CAAE,GAAG,EAAE,MAAM,qBAqBvD;AAGD,wBAAsB,cAAc,CAAC,WAAW,EAAE,MAAM,+BAgBvD;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,UAU9D"}
|
package/build/vite/utils.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import url from 'node:url';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
+
import logger from '@wdio/logger';
|
|
4
5
|
import { resolve } from 'import-meta-resolve';
|
|
6
|
+
import { MOCHA_VARIABELS } from '../constants.js';
|
|
7
|
+
const log = logger('@wdio/browser-runner');
|
|
5
8
|
export async function getTemplate(options, env, spec, processEnv = process.env) {
|
|
6
9
|
const root = options.rootDir || process.cwd();
|
|
7
10
|
const rootFileUrl = url.pathToFileURL(root).href;
|
|
@@ -29,20 +32,24 @@ export async function getTemplate(options, env, spec, processEnv = process.env)
|
|
|
29
32
|
`Error: ${err.stack}`);
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
let sourceMapScript = '';
|
|
36
|
+
let sourceMapSetupCommand = '';
|
|
37
|
+
await resolve('source-map-supposrt', import.meta.url).then((sourceMapSupportDir) => {
|
|
38
|
+
sourceMapScript = /*html*/ `<script src="/@fs/${url.fileURLToPath(path.dirname(sourceMapSupportDir))}/browser-source-map-support.js"></script>`;
|
|
39
|
+
sourceMapSetupCommand = 'sourceMapSupport.install()';
|
|
40
|
+
}, (err) => {
|
|
41
|
+
log.error(`Failed to setup source-map-support: ${err.message}`);
|
|
42
|
+
});
|
|
35
43
|
return /* html */ `
|
|
36
44
|
<!doctype html>
|
|
37
45
|
<html>
|
|
38
46
|
<head>
|
|
39
47
|
<title>WebdriverIO Browser Test</title>
|
|
40
48
|
<link rel="icon" type="image/x-icon" href="https://webdriver.io/img/favicon.png">
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
<script src="/@fs/${sourceMapSupportDir}/browser-source-map-support.js"></script>
|
|
49
|
+
<script type="module" src="/node_modules/mocha/mocha.js"></script>
|
|
50
|
+
${sourceMapScript}
|
|
44
51
|
<script type="module">
|
|
45
|
-
|
|
52
|
+
${sourceMapSetupCommand}
|
|
46
53
|
|
|
47
54
|
/**
|
|
48
55
|
* Inject environment variables
|
|
@@ -64,14 +71,16 @@ export async function getTemplate(options, env, spec, processEnv = process.env)
|
|
|
64
71
|
*/
|
|
65
72
|
window.process = {
|
|
66
73
|
platform: 'browser',
|
|
67
|
-
env: {}
|
|
74
|
+
env: {},
|
|
75
|
+
stdout: {}
|
|
68
76
|
}
|
|
69
77
|
</script>
|
|
78
|
+
<script type="module" src="@wdio/browser-runner/setup"></script>
|
|
79
|
+
<style>${MOCHA_VARIABELS}</style>
|
|
70
80
|
${vueDeps}
|
|
71
81
|
</head>
|
|
72
|
-
<body>
|
|
73
|
-
<
|
|
74
|
-
<script async type="module" src="@wdio/browser-runner/setup"></script>
|
|
82
|
+
<body style="width: calc(100% - 500px); padding: 0; margin: 0;">
|
|
83
|
+
<mocha-framework spec="${spec}" ${process.env.CI ? 'minified' : ''}></mocha-framework>
|
|
75
84
|
<script type="module">
|
|
76
85
|
window.process.env = ${JSON.stringify(processEnv)}
|
|
77
86
|
</script>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/browser-runner",
|
|
3
|
-
"version": "8.5.
|
|
3
|
+
"version": "8.5.6",
|
|
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",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
"@types/istanbul-lib-source-maps": "^4.0.1",
|
|
33
33
|
"@types/node": "^18.14.0",
|
|
34
34
|
"@vitest/spy": "^0.29.1",
|
|
35
|
-
"@wdio/globals": "8.5.
|
|
36
|
-
"@wdio/local-runner": "8.5.
|
|
35
|
+
"@wdio/globals": "8.5.6",
|
|
36
|
+
"@wdio/local-runner": "8.5.6",
|
|
37
37
|
"@wdio/logger": "8.1.0",
|
|
38
|
-
"@wdio/mocha-framework": "8.
|
|
39
|
-
"@wdio/protocols": "8.
|
|
38
|
+
"@wdio/mocha-framework": "8.5.6",
|
|
39
|
+
"@wdio/protocols": "8.5.6",
|
|
40
40
|
"@wdio/types": "8.4.0",
|
|
41
|
-
"@wdio/utils": "8.
|
|
41
|
+
"@wdio/utils": "8.5.6",
|
|
42
42
|
"ast-types": "^0.14.2",
|
|
43
43
|
"deepmerge-ts": "^4.3.0",
|
|
44
44
|
"expect-webdriverio": "^4.1.2",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"vite": "^4.1.3",
|
|
57
57
|
"vite-plugin-istanbul": "^4.0.0",
|
|
58
58
|
"vite-plugin-top-level-await": "^1.2.4",
|
|
59
|
-
"webdriver": "8.5.
|
|
60
|
-
"webdriverio": "8.5.
|
|
59
|
+
"webdriver": "8.5.6",
|
|
60
|
+
"webdriverio": "8.5.6",
|
|
61
61
|
"ws": "^8.12.1"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@types/ws": "^8.5.4",
|
|
71
|
-
"@wdio/runner": "8.5.
|
|
71
|
+
"@wdio/runner": "8.5.6"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "01be486a93582b19bfade3f6f0778f2b5e2d4c01"
|
|
74
74
|
}
|