MCPcopy Create free account
hub / github.com/angular/components / launchChromeAndRunLighthouse

Function launchChromeAndRunLighthouse

docs/tools/lighthouse-audit.mjs:138–154  ·  view source on GitHub ↗

* @param url the URL to run Lighthouse against * @param flags Lighthouse flags * @param config Lighthouse JSON config * @returns the result of the Lighthouse run

(url, flags, config)

Source from the content-addressed store, hash-verified

136 * @returns the result of the Lighthouse run
137 */
138async function launchChromeAndRunLighthouse(url, flags, config) {
139 const browser = await puppeteer.launch({
140 // Allow for a custom chromium to be provided (e.g. for M1 native support)
141 executablePath: process.env.CHROMIUM_BIN,
142 args: ['--no-sandbox'],
143 headless: 'new',
144 });
145
146 const page = await browser.newPage();
147
148 try {
149 return await lighthouse(url, flags, config, page);
150 } finally {
151 await page.close();
152 await browser.close();
153 }
154}
155
156/**
157 * @param {string} err the error message

Callers 1

_mainFunction · 0.85

Calls 2

launchMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected