Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getPerf(scenario) {
const url = 'http://localhost:8080/' + scenario;
let launchedChrome = null
return ChromeLauncher.launch({port: 9222})
.then((chrome) => {
launchedChrome = chrome;
const lhOpts = {mobile: true, loadPage: true};
return lighthouse(url, lhOpts, perfConfig)
.then(res => {
report = res;
delete report.audits['screenshot-thumbnails'];
delete report.reportCategories;
delete report.reportGroups;
});
})
.then(() => {
if (launchedChrome) {
launchedChrome.kill();
}
})