Introduce GEMINI_CLI_HOME for strict test isolation (#15907)

This commit is contained in:
N. Taylor Mullen
2026-01-06 20:09:39 -08:00
committed by GitHub
parent a26463b056
commit 7956eb239e
54 changed files with 455 additions and 148 deletions
@@ -38,6 +38,15 @@ vi.mock('node:os', async (importOriginal) => {
};
});
vi.mock('@google/gemini-cli-core', async (importOriginal) => {
const actual =
await importOriginal<typeof import('@google/gemini-cli-core')>();
return {
...actual,
tmpdir: vi.fn(() => '/tmp'),
};
});
const vscodeMock = vi.hoisted(() => ({
workspace: {
workspaceFolders: [
@@ -23,7 +23,7 @@ import { randomUUID } from 'node:crypto';
import { type Server as HTTPServer } from 'node:http';
import * as path from 'node:path';
import * as fs from 'node:fs/promises';
import * as os from 'node:os';
import { tmpdir } from '@google/gemini-cli-core';
import type { z } from 'zod';
import type { DiffManager } from './diff-manager.js';
import { OpenFilesManager } from './open-files-manager.js';
@@ -343,7 +343,7 @@ export class IDEServer {
this.log(`IDE server listening on http://127.0.0.1:${this.port}`);
let portFile: string | undefined;
try {
const portDir = path.join(os.tmpdir(), 'gemini', 'ide');
const portDir = path.join(tmpdir(), 'gemini', 'ide');
await fs.mkdir(portDir, { recursive: true });
portFile = path.join(
portDir,