Skip to content

Commit 199dec9

Browse files
committed
test(ipc): simplify stale file cleanup test logic
The test was allowing two success paths: 1. File is deleted (expected) 2. File exists but with different timestamp (recreated by another process) However, if deletion silently failed (error caught in cleanupIpcStubs), the file would exist with the same timestamp causing test failure. Changes: - Remove complex "recreated file" logic - Add 100ms delay after cleanup for slow CI environments - Assert file is deleted - fail clearly if not Fixes CI flakiness where async deletion wasn't completing in time.
1 parent bc0630c commit 199dec9

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

test/ipc.test.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -213,20 +213,16 @@ describe('ipc', () => {
213213

214214
await cleanupIpcStubs('cleanup-test')
215215

216-
// Stale file should be deleted or have a different timestamp (deleted and recreated).
216+
// Add delay to allow async deletion to complete in slow CI environments
217+
await new Promise(resolve => setTimeout(resolve, 100))
218+
219+
// Stale file should be deleted
217220
const staleExists = await fs
218221
.access(staleFile)
219222
.then(() => true)
220223
.catch(() => false)
221224

222-
if (staleExists) {
223-
// File exists, check if it's a different file (timestamp changed)
224-
const content = await fs.readFile(staleFile, 'utf8')
225-
const parsed = JSON.parse(content)
226-
// Test passes if timestamp changed (file was deleted and recreated)
227-
expect(parsed.timestamp).not.toBe(staleTimestamp)
228-
}
229-
// If file doesn't exist, test passes
225+
expect(staleExists).toBe(false)
230226

231227
// Fresh files should still exist.
232228
const fresh1Exists = await fs

0 commit comments

Comments
 (0)