@@ -5,27 +5,24 @@ import log from 'lighthouse-logger';
55export const runLighthouse = async ( url , settings ) => {
66 let chrome ;
77 try {
8- const logLevel = settings ?. logLevel || 'error' ;
8+ // Set debug level logging to see what's happening
9+ const logLevel = 'info' ;
910 log . setLevel ( logLevel ) ;
1011
11- // Launch Chrome using chrome-launcher with additional CI-friendly flags
12+ console . log ( 'Launching Chrome...' ) ;
13+ // Launch Chrome with minimal flags
1214 chrome = await chromeLauncher . launch ( {
1315 chromeFlags : [
1416 '--headless=new' ,
1517 '--no-sandbox' ,
1618 '--disable-gpu' ,
1719 '--disable-dev-shm-usage' ,
18- '--disable-software-rasterizer' ,
19- '--disable-setuid-sandbox' ,
20- '--no-zygote' ,
21- '--disable-web-security' ,
22- '--allow-running-insecure-content' ,
23- '--disable-features=IsolateOrigins,site-per-process' ,
24- '--single-process' , // Try running in a single process
2520 ] ,
21+ logLevel,
2622 handleSIGINT : true ,
27- chromePath : process . env . CHROME_PATH , // Allow custom Chrome path in CI
2823 } ) ;
24+ console . log ( 'Chrome launched on port:' , chrome . port ) ;
25+ console . log ( 'Starting Lighthouse audit for URL:' , url ) ;
2926 const results = await lighthouse (
3027 url ,
3128 {
@@ -38,9 +35,14 @@ export const runLighthouse = async (url, settings) => {
3835 } ,
3936 settings ,
4037 ) ;
38+ console . log ( 'Lighthouse audit completed' ) ;
4139 return results ;
40+ } catch ( error ) {
41+ console . error ( 'Error during Lighthouse run:' , error ) ;
42+ throw error ;
4243 } finally {
4344 if ( chrome ) {
45+ console . log ( 'Cleaning up Chrome...' ) ;
4446 await chrome . kill ( ) ;
4547 }
4648 }
0 commit comments