DEV: Handle occasional 'No inspectable targets' error in run-qunit
This is to work around https://github.com/GoogleChrome/chrome-launcher/issues/145
This commit is contained in:
parent
4c9ca24ccf
commit
43ca1bb132
|
@ -54,7 +54,26 @@ async function runAllTests() {
|
|||
}
|
||||
|
||||
let chrome = await launchChrome();
|
||||
let protocol = await CDP({ port: chrome.port });
|
||||
|
||||
let protocol = null;
|
||||
let connectAttempts = 0;
|
||||
while (!protocol) {
|
||||
// Workaround for intermittent CI error caused by
|
||||
// https://github.com/GoogleChrome/chrome-launcher/issues/145
|
||||
try {
|
||||
protocol = await CDP({ port: chrome.port });
|
||||
} catch (e) {
|
||||
if (e === "No inspectable targets" && connectAttempts < 50) {
|
||||
connectAttempts++;
|
||||
console.log(
|
||||
"Unable to establish connection to chrome target - trying again..."
|
||||
);
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const { Inspector, Page, Runtime } = protocol;
|
||||
|
||||
|
|
Loading…
Reference in New Issue