diff --git a/integration-tests/globalSetup.ts b/integration-tests/globalSetup.ts index 189d15f188..503e528c47 100644 --- a/integration-tests/globalSetup.ts +++ b/integration-tests/globalSetup.ts @@ -12,6 +12,7 @@ if (process.env['NO_COLOR'] !== undefined) { import { mkdir, readdir, rm } from 'node:fs/promises'; import { join, dirname } from 'node:path'; import { fileURLToPath } from 'node:url'; +import { canUseRipgrep } from '../packages/core/src/tools/ripGrep.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); const rootDir = join(__dirname, '..'); @@ -32,6 +33,12 @@ export async function setup() { // construct the path before the HOME env var is set. process.env['GEMINI_CONFIG_DIR'] = join(runDir, '.gemini'); + // Download ripgrep to avoid race conditions in parallel tests + const available = await canUseRipgrep(); + if (!available) { + throw new Error('Failed to download ripgrep binary'); + } + // Clean up old test runs, but keep the latest few for debugging try { const testRuns = await readdir(integrationTestsDir);