File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 1
1
const puppeteer = require ( 'puppeteer' ) ;
2
2
const lighthouse = require ( 'lighthouse' ) ;
3
+ const log = require ( 'lighthouse-logger' ) ;
3
4
const chromeLauncher = require ( 'chrome-launcher' ) ;
4
5
5
6
const getBrowserPath = async ( ) => {
@@ -15,12 +16,16 @@ const getBrowserPath = async () => {
15
16
const runLighthouse = async ( browserPath , url ) => {
16
17
let chrome ;
17
18
try {
19
+ const logLevel = 'info' ;
20
+ log . setLevel ( logLevel ) ;
18
21
chrome = await chromeLauncher . launch ( {
19
22
chromePath : browserPath ,
20
23
chromeFlags : [ '--headless' , '--no-sandbox' , '--disable-gpu' ] ,
24
+ logLevel,
21
25
} ) ;
22
26
const results = await lighthouse ( url , {
23
27
port : chrome . port ,
28
+ logLevel,
24
29
} ) ;
25
30
if ( results . lhr . runtimeError ) {
26
31
throw new Error ( results . lhr . runtimeError . message ) ;
You can’t perform that action at this time.
0 commit comments