mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-20 18:14:29 -07:00
Introduce GEMINI_CLI_HOME for strict test isolation (#15907)
This commit is contained in:
@@ -14,8 +14,15 @@ vi.mock('node:child_process', async (importOriginal) => {
|
||||
spawnSync: vi.fn(() => ({ status: 0 })),
|
||||
};
|
||||
});
|
||||
vi.mock('fs');
|
||||
vi.mock('os');
|
||||
vi.mock('node:fs');
|
||||
vi.mock('node:os');
|
||||
vi.mock('../utils/paths.js', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('../utils/paths.js')>();
|
||||
return {
|
||||
...actual,
|
||||
homedir: vi.fn(),
|
||||
};
|
||||
});
|
||||
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||
import { getIdeInstaller } from './ide-installer.js';
|
||||
@@ -24,12 +31,14 @@ import * as fs from 'node:fs';
|
||||
import * as os from 'node:os';
|
||||
import * as path from 'node:path';
|
||||
import { IDE_DEFINITIONS, type IdeInfo } from './detect-ide.js';
|
||||
import { homedir as pathsHomedir } from '../utils/paths.js';
|
||||
|
||||
describe('ide-installer', () => {
|
||||
const HOME_DIR = '/home/user';
|
||||
|
||||
beforeEach(() => {
|
||||
vi.spyOn(os, 'homedir').mockReturnValue(HOME_DIR);
|
||||
vi.mocked(pathsHomedir).mockReturnValue(HOME_DIR);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
Reference in New Issue
Block a user