@@ -132,6 +132,8 @@ t.test('handles unknown error with logs and debug file', async (t) => {
132132 const { exitHandler, debugFile, logs } = await mockExitHandler ( t )
133133
134134 await exitHandler ( err ( 'Unknown error' , 'ECODE' ) )
135+ // force logfile cleaning logs to happen since those are purposefully not awaited
136+ await new Promise ( ( res ) => setTimeout ( res , 200 ) )
135137
136138 const fileLogs = await debugFile ( )
137139 const fileLines = fileLogs . split ( '\n' )
@@ -141,14 +143,19 @@ t.test('handles unknown error with logs and debug file', async (t) => {
141143
142144 t . equal ( process . exitCode , 1 )
143145
146+ let skippedLogs = 0
144147 logs . forEach ( ( logItem , i ) => {
145148 const logLines = format ( i , ...logItem ) . trim ( ) . split ( os . EOL )
146- logLines . forEach ( ( line ) => {
149+ for ( const line of logLines ) {
150+ if ( line . includes ( 'logfile' ) && line . includes ( 'cleaning' ) ) {
151+ skippedLogs ++
152+ continue
153+ }
147154 t . match ( fileLogs . trim ( ) , line , 'log appears in debug file' )
148- } )
155+ }
149156 } )
150157
151- t . equal ( logs . length , parseInt ( lastLog ) + 1 )
158+ t . equal ( logs . length - skippedLogs , parseInt ( lastLog ) + 1 )
152159 t . match ( logs . error , [
153160 [ 'code' , 'ECODE' ] ,
154161 [ 'ERR SUMMARY' , 'Unknown error' ] ,
0 commit comments