@@ -37,6 +37,7 @@ function byteLength(str) {
3737 return encoder . encode ( str ) . byteLength ;
3838}
3939
40+ // oxlint-disable-next-line max-lines-per-function
4041function waitForReady ( child , expectedResponse , signal ) {
4142 // oxlint-disable-next-line promise/avoid-new
4243 return new Promise ( ( resolve , reject ) => {
@@ -45,11 +46,11 @@ function waitForReady(child, expectedResponse, signal) {
4546
4647 let recentOutput = "" ;
4748
48- function recordOutput ( line ) {
49+ function recordOutput ( lineOutput ) {
4950 const safeLine =
50- byteLength ( line ) > MAX_ERROR_BUFFER_BYTES / 2
51- ? line . slice ( 0 , MAX_ERROR_BUFFER_BYTES / 2 ) + " …[truncated]"
52- : line ;
51+ byteLength ( lineOutput ) > MAX_ERROR_BUFFER_BYTES / 2
52+ ? ` ${ lineOutput . slice ( 0 , MAX_ERROR_BUFFER_BYTES / 2 ) } …[truncated]`
53+ : lineOutput ;
5354
5455 recentOutput = `${ recentOutput } ${ safeLine } \n` ;
5556
@@ -73,14 +74,14 @@ function waitForReady(child, expectedResponse, signal) {
7374 }
7475 }
7576
76- function onLine ( line ) {
77- console . log ( `[${ child . name } ] ${ line } ` ) ;
78- recordOutput ( line ) ;
79- if ( line . includes ( expectedResponse ) ) {
77+ function onLine ( lineOutput ) {
78+ console . log ( `[${ child . name } ] ${ lineOutput } ` ) ;
79+ recordOutput ( lineOutput ) ;
80+ if ( lineOutput . includes ( expectedResponse ) ) {
8081 cleanup ( ) ;
81- readlineStdout . on ( "line" , ( l ) => console . log ( `[${ child . name } ] ${ l } ` ) ) ;
82- readlineStderr . on ( "line" , ( l ) => console . log ( `[${ child . name } ] ${ l } ` ) ) ;
83- child . once ( "close" , ( code ) => console . log ( `[${ child . name } ] exited with code ${ code } ` ) ) ;
82+ readlineStdout . on ( "line" , ( line ) => { console . log ( `[${ child . name } ] ${ line } ` ) } ) ;
83+ readlineStderr . on ( "line" , ( line ) => { console . log ( `[${ child . name } ] ${ line } ` ) } ) ;
84+ child . once ( "close" , ( code ) => { console . log ( `[${ child . name } ] exited with code ${ code } ` ) } ) ;
8485 resolve ( child ) ;
8586 }
8687 }
0 commit comments