From d240d416beda1c1828624b4a695f77c8fd01d651 Mon Sep 17 00:00:00 2001 From: johnny4young Date: Thu, 15 Oct 2026 07:36:59 -0500 Subject: [PATCH] test(main): stop gitSecurity fixtures flaking on Windows runners - Each fixture git call was killed after 5 s; a cold git on a hosted Windows runner exceeded that during the fixture commit, and the half-finished repository then failed cleanup with EPERM. - Bound git calls at 30 s, give this file's hooks and tests 60 s for their several git calls, and retry temporary-directory removal as the Windows install test already does. Changelog: none --- tests/main/gitSecurity.test.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/main/gitSecurity.test.ts b/tests/main/gitSecurity.test.ts index 204a2fb59..99abe9941 100644 --- a/tests/main/gitSecurity.test.ts +++ b/tests/main/gitSecurity.test.ts @@ -21,12 +21,17 @@ import { resetGitProbeCacheForTests, } from '../../src/main/git'; +// A cold git on a hosted Windows runner can take several seconds per call, so +// bound each call generously and give hooks and tests room for several calls. +const GIT_TIMEOUT_MS = 30_000; +vi.setConfig({ testTimeout: 60_000, hookTimeout: 60_000 }); + let root: string; const git = (cwd: string, ...args: string[]) => execFileSync('git', args, { cwd, encoding: 'utf8', - timeout: 5000, + timeout: GIT_TIMEOUT_MS, env: { ...process.env, GIT_CONFIG_NOSYSTEM: '1', @@ -46,7 +51,8 @@ beforeEach(() => { }); afterEach(() => { vi.unstubAllEnvs(); - rmSync(root, { recursive: true, force: true }); + // Windows can briefly hold git's files after it exits (EPERM/EBUSY). + rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 }); }); describe('read-only Git trust boundary', () => { @@ -130,7 +136,7 @@ describe('read-only Git trust boundary', () => { deletions: 1, }); } finally { - rmSync(home, { recursive: true, force: true }); + rmSync(home, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 }); } }); @@ -187,7 +193,7 @@ describe('working-tree side of a diff', () => { truncated: false, }); } finally { - rmSync(outside, { recursive: true, force: true }); + rmSync(outside, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 }); } });