11import { fork , spawn } from 'node:child_process' ;
22import { on , once } from 'node:events' ;
3- import { openSync , statSync } from 'node:fs' ;
3+ import { openSync } from 'node:fs' ;
44import { readFile , unlink , writeFile } from 'node:fs/promises' ;
55import * as path from 'node:path' ;
66
@@ -194,11 +194,11 @@ export async function runScriptAndGetProcessInfo(
194194 . map ( line => JSON . parse ( line ) )
195195 . reduce ( ( acc , curr ) => ( { ...acc , ...curr } ) , { } ) ;
196196
197- const stdErrSize = statSync ( stdErrFile ) . size ;
197+ const stdErrSize = await readFile ( stdErrFile , { encoding : 'utf8' } ) ;
198198
199199 // delete temporary files
200200 await unlink ( scriptName ) ;
201- // await unlink(logFile);
201+ await unlink ( logFile ) ;
202202 await unlink ( stdErrFile ) ;
203203
204204 // assertions about exit status
@@ -210,11 +210,11 @@ export async function runScriptAndGetProcessInfo(
210210 throw assertionError ;
211211 }
212212
213- // assertion about error output
214- expect ( stdErrSize ) . to . equal ( 0 ) ;
215-
216213 // assertions about resource status
217214 expect ( messages . beforeExitHappened ) . to . be . true ;
218215 expect ( messages . newResources . libuvResources ) . to . be . empty ;
219216 expect ( messages . newResources . activeResources ) . to . be . empty ;
217+
218+ // assertion about error output
219+ expect ( stdErrSize ) . to . be . empty ;
220220}
0 commit comments