@wdio/shared-store-service 7.16.2 → 7.16.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.
- package/build/client.d.ts.map +1 -1
- package/build/client.js +27 -0
- package/build/launcher.d.ts.map +1 -1
- package/build/launcher.js +2 -0
- package/package.json +4 -4
package/build/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AASvF,eAAO,MAAM,OAAO,SAAU,MAAM,SAA6C,CAAA;AAEjF;;;;GAIG;AACH,eAAO,MAAM,QAAQ,QAAe,MAAM,KAAG,QAAQ,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,CAGzH,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,QAAQ,QAAe,MAAM,SAAS,cAAc,GAAG,aAAa,kBAgChF,CAAA"}
|
package/build/client.js
CHANGED
|
@@ -7,6 +7,9 @@ exports.setValue = exports.getValue = exports.setPort = void 0;
|
|
|
7
7
|
const got_1 = __importDefault(require("got"));
|
|
8
8
|
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
9
9
|
const log = (0, logger_1.default)('@wdio/shared-store-service');
|
|
10
|
+
const WAIT_INTERVAL = 100;
|
|
11
|
+
const pendingValues = new Map();
|
|
12
|
+
let waitTimeout;
|
|
10
13
|
let baseUrl;
|
|
11
14
|
const setPort = (port) => { baseUrl = `http://localhost:${port}`; };
|
|
12
15
|
exports.setPort = setPort;
|
|
@@ -26,6 +29,30 @@ exports.getValue = getValue;
|
|
|
26
29
|
* @param {*} value `store[key]` value (plain object)
|
|
27
30
|
*/
|
|
28
31
|
const setValue = async (key, value) => {
|
|
32
|
+
/**
|
|
33
|
+
* if someone calls `setValue` in `onPrepare` we don't have a base url
|
|
34
|
+
* set as the launcher is called after user hooks. In this case we need
|
|
35
|
+
* to wait until it is set and flush all messages.
|
|
36
|
+
*/
|
|
37
|
+
if (!baseUrl) {
|
|
38
|
+
log.info('Shared store server not yet started, collecting value');
|
|
39
|
+
pendingValues.set(key, value);
|
|
40
|
+
if (!waitTimeout) {
|
|
41
|
+
log.info('Check shared store server to start');
|
|
42
|
+
waitTimeout = setInterval(async () => {
|
|
43
|
+
if (!baseUrl) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
log.info(`Shared store server started, flushing ${pendingValues.size} values`);
|
|
47
|
+
clearInterval(waitTimeout);
|
|
48
|
+
await Promise.all([...pendingValues.entries()].map(async ([key, value]) => {
|
|
49
|
+
await got_1.default.post(`${baseUrl}/set`, { json: { key, value } }).catch(errHandler);
|
|
50
|
+
pendingValues.delete(key);
|
|
51
|
+
})).then(() => log.info('All pending values were successfully stored'), (err) => log.error(`Failed to store all values: ${err.stack}`));
|
|
52
|
+
}, WAIT_INTERVAL);
|
|
53
|
+
}
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
29
56
|
await got_1.default.post(`${baseUrl}/set`, { json: { key, value } }).catch(errHandler);
|
|
30
57
|
};
|
|
31
58
|
exports.setValue = setValue;
|
package/build/launcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,OAAO,mBAAmB;IACpC,OAAO,EAAE,MAAM,CAAA;;IAMT,SAAS;IAST,UAAU;CAInB"}
|
package/build/launcher.js
CHANGED
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
7
7
|
const utils_1 = require("./utils");
|
|
8
|
+
const client_1 = require("./client");
|
|
8
9
|
const log = (0, logger_1.default)('@wdio/shared-store-service');
|
|
9
10
|
let server;
|
|
10
11
|
class SharedStoreLauncher {
|
|
@@ -15,6 +16,7 @@ class SharedStoreLauncher {
|
|
|
15
16
|
async onPrepare() {
|
|
16
17
|
server = require('./server').default;
|
|
17
18
|
const result = await server.startServer();
|
|
19
|
+
(0, client_1.setPort)(result.port);
|
|
18
20
|
log.info(`Started shared server on port ${result.port}`);
|
|
19
21
|
await (0, utils_1.writeFile)(this.pidFile, result.port.toString());
|
|
20
22
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/shared-store-service",
|
|
3
|
-
"version": "7.16.
|
|
3
|
+
"version": "7.16.3",
|
|
4
4
|
"description": "A WebdriverIO service to exchange data across processes",
|
|
5
5
|
"author": "Mykola Grybyk <mykola.grybyk@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-shared-store-service",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@polka/parse": "^1.0.0-next.0",
|
|
27
27
|
"@wdio/logger": "7.16.0",
|
|
28
|
-
"@wdio/types": "7.16.
|
|
28
|
+
"@wdio/types": "7.16.3",
|
|
29
29
|
"got": "^11.0.2",
|
|
30
30
|
"polka": "^0.5.2",
|
|
31
|
-
"webdriverio": "7.16.
|
|
31
|
+
"webdriverio": "7.16.3"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"types": "./build/index.d.ts",
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "23e2af933060e829f03d7518089c377571c654e3"
|
|
38
38
|
}
|