@@ -1880,6 +1880,7 @@ function startFixtureServer(cwd: string) {
18801880 // pnpm's binary shims set NODE_PATH to the workspace virtual store, which lets
18811881 // CJS resolution find workspace packages that the fixture app cannot import via ESM.
18821882 let { NODE_PATH : _nodePath , ...env } = process . env
1883+ let traceStart = Date . now ( )
18831884 let child = spawn ( process . execPath , [ 'dev.ts' ] , {
18841885 cwd,
18851886 env : {
@@ -1894,10 +1895,20 @@ function startFixtureServer(cwd: string) {
18941895 let hmrUrlWaiters : Array < ( ) => void > = [ ]
18951896 let lineBuffer = ''
18961897 let processOutput = ''
1898+ let processTrace = [ `[+0ms] spawned fixture process (pid ${ child . pid ?? 'unknown' } )` ]
18971899 let exit : { code : number | null ; signal : NodeJS . Signals | null } | null = null
18981900
1901+ function traceProcessOutput ( kind : 'stderr' | 'stdout' , chunk : string ) : void {
1902+ for ( let line of chunk . trimEnd ( ) . split ( / \r ? \n / ) ) {
1903+ if ( line . length > 0 ) {
1904+ processTrace . push ( `[+${ Date . now ( ) - traceStart } ms] ${ kind } : ${ line } ` )
1905+ }
1906+ }
1907+ }
1908+
18991909 child . stdout ?. setEncoding ( 'utf-8' )
19001910 child . stdout ?. on ( 'data' , ( chunk : string ) => {
1911+ traceProcessOutput ( 'stdout' , chunk )
19011912 processOutput += chunk
19021913 lineBuffer += chunk
19031914
@@ -1928,11 +1939,15 @@ function startFixtureServer(cwd: string) {
19281939
19291940 child . stderr ?. setEncoding ( 'utf-8' )
19301941 child . stderr ?. on ( 'data' , ( chunk : string ) => {
1942+ traceProcessOutput ( 'stderr' , chunk )
19311943 processOutput += chunk
19321944 } )
19331945
19341946 child . once ( 'exit' , ( code , signal ) => {
19351947 exit = { code, signal }
1948+ processTrace . push (
1949+ `[+${ Date . now ( ) - traceStart } ms] process exited (code ${ code } , signal ${ signal } )` ,
1950+ )
19361951 } )
19371952
19381953 return {
@@ -1951,7 +1966,11 @@ function startFixtureServer(cwd: string) {
19511966 let exitText = exit
19521967 ? ` Process exited with code ${ exit . code } and signal ${ exit . signal } .`
19531968 : ''
1954- return `Timed out waiting for fixture server.${ exitText } \n${ processOutput } `
1969+ return [
1970+ `Timed out waiting for fixture server.${ exitText } ` ,
1971+ processOutput ,
1972+ `Process trace:\n${ processTrace . join ( '\n' ) } ` ,
1973+ ] . join ( '\n' )
19551974 } ,
19561975 fixtureServerReadyTimeout ,
19571976 )
0 commit comments