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

View File

@@ -74,6 +74,7 @@ vi.mock('node:process', () => {
exit: mockProcessExit,
platform: 'sunos',
cwd: () => '/fake/dir',
env: {},
} as unknown as NodeJS.Process;
return {
...mockProcess,

View File

@@ -30,6 +30,15 @@ vi.mock('os', async (importOriginal) => {
};
});
vi.mock('@google/gemini-cli-core', async (importOriginal) => {
const actual =
await importOriginal<typeof import('@google/gemini-cli-core')>();
return {
...actual,
homedir: () => os.homedir(),
};
});
vi.mock('../../config/extensions/update.js', () => ({
checkForAllExtensionUpdates: vi.fn(),
updateExtension: vi.fn(),

View File

@@ -28,9 +28,16 @@ const mockedIsWorkspaceTrusted = vi.hoisted(() => vi.fn());
const mockedUseSettings = vi.hoisted(() => vi.fn());
// Mock modules
vi.mock('node:process', () => ({
cwd: mockedCwd,
}));
vi.mock('node:process', () => {
const mockProcess = {
cwd: mockedCwd,
env: {},
};
return {
...mockProcess,
default: mockProcess,
};
});
vi.mock('node:path', async (importOriginal) => {
const actual = await importOriginal();