-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,6 +132,8 @@ t.test('handles unknown error with logs and debug file', async (t) => { | |
const { exitHandler, debugFile, logs } = await mockExitHandler(t) | ||
|
||
await exitHandler(err('Unknown error', 'ECODE')) | ||
// force logfile cleaning logs to happen since those are purposefully not awaited | ||
await require('timers/promises').setTimeout(200) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
lukekarrys
Author
Contributor
|
||
|
||
const fileLogs = await debugFile() | ||
const fileLines = fileLogs.split('\n') | ||
|
@@ -141,14 +143,19 @@ t.test('handles unknown error with logs and debug file', async (t) => { | |
|
||
t.equal(process.exitCode, 1) | ||
|
||
let skippedLogs = 0 | ||
logs.forEach((logItem, i) => { | ||
const logLines = format(i, ...logItem).trim().split(os.EOL) | ||
logLines.forEach((line) => { | ||
for (const line of logLines) { | ||
if (line.includes('logfile') && line.includes('cleaning')) { | ||
skippedLogs++ | ||
continue | ||
} | ||
t.match(fileLogs.trim(), line, 'log appears in debug file') | ||
}) | ||
} | ||
}) | ||
|
||
t.equal(logs.length, parseInt(lastLog) + 1) | ||
t.equal(logs.length - skippedLogs, parseInt(lastLog) + 1) | ||
t.match(logs.error, [ | ||
['code', 'ECODE'], | ||
['ERR SUMMARY', 'Unknown error'], | ||
|
This change looks strange to me. Why was it necessary?