Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function launchChromeAndRunLighthouse(url, flags, config) {
const launcher = new ChromeLauncher({
port: 9222,
autoSelectChrome: true,
});
return launcher
.isDebuggerReady()
.catch(() => {
if (flags.skipAutolaunch) {
return;
}
return launcher.run();
})
.then(() => Lighthouse(url, flags, config))
.then(results => launcher.kill().then(() => results))
.catch(err => {
return launcher.kill().then(() => {
throw err;
function launchChrome(opts) {
return new ChromeLauncher(opts);
}