From cb8fc94180bc9877efe5826c3c93ec6c723bcd46 Mon Sep 17 00:00:00 2001 From: Raphael Antonietti Date: Fri, 31 Jul 2026 12:55:25 +0200 Subject: [PATCH] test(core): make file-lock timing check deterministic --- tests/unit/file-lock.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/file-lock.test.ts b/tests/unit/file-lock.test.ts index b3dd1e73..e722df6e 100644 --- a/tests/unit/file-lock.test.ts +++ b/tests/unit/file-lock.test.ts @@ -151,8 +151,8 @@ describe('withFileLock', () => { writeFileSync(lockPath, JSON.stringify({ pid: process.pid, uuid: 'holder', hostname: hostname(), acquiredAt: new Date().toISOString(), }), { flag: 'wx' }); - execFile(process.execPath, ['-e', `setTimeout(() => require('node:fs').unlinkSync(${JSON.stringify(lockPath)}), 300)`]); const started = Date.now(); + execFile(process.execPath, ['-e', `setTimeout(() => require('node:fs').unlinkSync(${JSON.stringify(lockPath)}), 300)`]); let observedAcquiredAt = ''; withFileLock(lockPath, () => { observedAcquiredAt = JSON.parse(readFileSync(lockPath, 'utf-8')).acquiredAt;