creevey 0.8.2-fix-wait.1 → 0.8.2-fix-wait.2
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.
@@ -140,6 +140,7 @@ async function waitForStorybook(browser) {
|
|
140
140
|
wait = await browser.executeScript(function (SET_STORIES) {
|
141
141
|
if (typeof window.__STORYBOOK_ADDONS_CHANNEL__ == 'undefined') return true;
|
142
142
|
if (window.__STORYBOOK_ADDONS_CHANNEL__.last(SET_STORIES) == undefined) return true;
|
143
|
+
if (typeof window.__CREEVEY_UPDATE_GLOBALS__ == 'undefined') return true;
|
143
144
|
return false;
|
144
145
|
}, Events.SET_STORIES);
|
145
146
|
if (!wait) clearTimeout(initiateTimeout);
|
@@ -411,10 +412,12 @@ async function resolveCreeveyHost(browser, port) {
|
|
411
412
|
const addresses = getAddresses();
|
412
413
|
creeveyServerHost = await browser.executeAsyncScript(function (hosts, port, callback) {
|
413
414
|
void Promise.all(hosts.map(function (host) {
|
414
|
-
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
415
|
-
|
415
|
+
return Promise.race([// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
416
|
+
fetch('http://' + host + ':' + port + '/ping').then(function (response) {
|
416
417
|
return response.text();
|
417
|
-
})
|
418
|
+
}), new Promise((_resolve, reject) => {
|
419
|
+
setTimeout(reject, 5000);
|
420
|
+
})]).then(function (pong) {
|
418
421
|
return pong == 'pong' ? host : null;
|
419
422
|
}).catch(function () {
|
420
423
|
return null;
|
@@ -112,6 +112,7 @@ async function waitForStorybook(browser) {
|
|
112
112
|
wait = await browser.executeScript(function (SET_STORIES) {
|
113
113
|
if (typeof window.__STORYBOOK_ADDONS_CHANNEL__ == 'undefined') return true;
|
114
114
|
if (window.__STORYBOOK_ADDONS_CHANNEL__.last(SET_STORIES) == undefined) return true;
|
115
|
+
if (typeof window.__CREEVEY_UPDATE_GLOBALS__ == 'undefined') return true;
|
115
116
|
return false;
|
116
117
|
}, Events.SET_STORIES);
|
117
118
|
if (!wait) clearTimeout(initiateTimeout);
|
@@ -383,10 +384,12 @@ async function resolveCreeveyHost(browser, port) {
|
|
383
384
|
const addresses = getAddresses();
|
384
385
|
creeveyServerHost = await browser.executeAsyncScript(function (hosts, port, callback) {
|
385
386
|
void Promise.all(hosts.map(function (host) {
|
386
|
-
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
387
|
-
|
387
|
+
return Promise.race([// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
388
|
+
fetch('http://' + host + ':' + port + '/ping').then(function (response) {
|
388
389
|
return response.text();
|
389
|
-
})
|
390
|
+
}), new Promise((_resolve, reject) => {
|
391
|
+
setTimeout(reject, 5000);
|
392
|
+
})]).then(function (pong) {
|
390
393
|
return pong == 'pong' ? host : null;
|
391
394
|
}).catch(function () {
|
392
395
|
return null;
|