Skip to content

Commit fb7f527

Browse files
committed
fix(ci): resolve test failures and missing .env.test file
- Add .env.test file required by dotenvx on Windows CI environments - Fix flaky IPC cleanupIpcStubs test by increasing stale threshold from 6 to 10 minutes - Add 50ms filesystem sync delay to prevent race conditions in CI The 6-minute margin was too close to the 5-minute cleanup threshold, causing intermittent failures due to timing variations and filesystem behavior differences across CI platforms.
1 parent ec6a34e commit fb7f527

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

.env.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Test environment variables
2+
# This file is used by the test runner via dotenvx
3+
# Add any test-specific environment variables below
4+

test/ipc.test.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ describe('ipc', () => {
149149
})
150150

151151
// Make the file stale by modifying its timestamp.
152-
// 6 minutes ago.
153-
const staleTimestamp = Date.now() - 6 * 60 * 1000
152+
// 10 minutes ago (well past the 5-minute threshold for robustness).
153+
const staleTimestamp = Date.now() - 10 * 60 * 1000
154154
const staleStub = {
155155
data: { data: 'old' },
156156
pid: process.pid,
@@ -196,8 +196,8 @@ describe('ipc', () => {
196196
// Make one file stale.
197197
const dir = path.dirname(stubPath1)
198198
const staleFile = path.join(dir, 'stub-99999.json')
199-
// 6 minutes ago.
200-
const staleTimestamp = Date.now() - 6 * 60 * 1000
199+
// 10 minutes ago (well past the 5-minute threshold for robustness).
200+
const staleTimestamp = Date.now() - 10 * 60 * 1000
201201
const staleStub = {
202202
data: { test: 'stale' },
203203
pid: 99_999,
@@ -212,6 +212,9 @@ describe('ipc', () => {
212212
const staleTime = new Date(staleTimestamp)
213213
await fs.utimes(staleFile, staleTime, staleTime)
214214

215+
// Small delay to ensure filesystem operations are fully committed
216+
await new Promise(resolve => setTimeout(resolve, 50))
217+
215218
await cleanupIpcStubs('cleanup-test')
216219

217220
// Stale file should be deleted.

0 commit comments

Comments
 (0)