Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions tests/main/gitSecurity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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', () => {
Expand Down Expand Up @@ -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 });
}
});

Expand Down Expand Up @@ -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 });
}
});

Expand Down
Loading