File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -32,16 +32,14 @@ puppeteer
3232 const page = await browser . newPage ( )
3333 page
3434 . on ( 'console' , async message => {
35- let text = message . text ( )
36- const args = await Promise . all ( message . args ( ) . map ( arg => describe ( arg ) ) )
37- for ( let i = 0 ; i < args . length ; ++ i ) {
38- text += `[${ i } ] ${ args [ i ] } `
39- }
40- console . log ( `${ message . type ( ) . substr ( 0 , 3 ) . toUpperCase ( ) } ${ text } ` )
35+ const argsText = await Promise . all (
36+ message . args ( ) . map ( arg => describe ( arg ) ) ,
37+ ) . join ( ' ' )
38+ console . log ( `${ message . type ( ) . substr ( 0 , 3 ) . toUpperCase ( ) } ${ argsText } ` )
4139 if (
4240 autoCloseBrowser &&
4341 message . type ( ) === 'error' &&
44- text . startsWith ( 'fail!' )
42+ message . text ( ) . startsWith ( 'fail!' )
4543 ) {
4644 browser . close ( )
4745 process . exit ( 1 )
@@ -73,7 +71,6 @@ puppeteer
7371
7472function describe ( jsHandle ) {
7573 return jsHandle . executionContext ( ) . evaluate ( obj => {
76- // serialize |obj| however you want
77- return `OBJ: ${ typeof obj } , ${ obj } `
74+ return `${ obj } `
7875 } , jsHandle )
7976}
You can’t perform that action at this time.
0 commit comments