fix(aio): fix PWA testing on Windows (and reduce flaky-ness)
Adding a delay after Lighthouse has run and before killing the Chrome process avoids `ECONNREFUSED` errors on Windows and will hopefully prevent such errors occasionally appearing on CI. Based on info in: https://github.com/paulirish/pwmetrics/issues/63#issuecomment-282721068
This commit is contained in:
parent
39f2977fa8
commit
3a604ba0bf
|
@ -79,6 +79,9 @@ function launchChromeAndRunLighthouse(url, flags, config) {
|
||||||
|
|
||||||
return launcher.run().
|
return launcher.run().
|
||||||
then(() => lighthouse(url, flags, config)).
|
then(() => lighthouse(url, flags, config)).
|
||||||
|
// Avoid race condition by adding a delay before killing Chrome.
|
||||||
|
// (See also https://github.com/paulirish/pwmetrics/issues/63#issuecomment-282721068.)
|
||||||
|
then(results => new Promise(resolve => setTimeout(() => resolve(results), 1000))).
|
||||||
then(results => launcher.kill().then(() => results)).
|
then(results => launcher.kill().then(() => results)).
|
||||||
catch(err => launcher.kill().then(() => { throw err; }, () => { throw err; }));
|
catch(err => launcher.kill().then(() => { throw err; }, () => { throw err; }));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue