mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-16 17:11:04 -07:00
Introduce GEMINI_CLI_HOME for strict test isolation (#15907)
This commit is contained in:
@@ -10,13 +10,13 @@ import { UserAccountManager } from './userAccountManager.js';
|
||||
import * as fs from 'node:fs';
|
||||
import * as os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { GEMINI_DIR } from './paths.js';
|
||||
import { GEMINI_DIR, homedir as pathsHomedir } from './paths.js';
|
||||
import { debugLogger } from './debugLogger.js';
|
||||
|
||||
vi.mock('os', async (importOriginal) => {
|
||||
const os = await importOriginal<typeof import('os')>();
|
||||
vi.mock('./paths.js', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('./paths.js')>();
|
||||
return {
|
||||
...os,
|
||||
...actual,
|
||||
homedir: vi.fn(),
|
||||
};
|
||||
});
|
||||
@@ -30,7 +30,7 @@ describe('UserAccountManager', () => {
|
||||
tempHomeDir = fs.mkdtempSync(
|
||||
path.join(os.tmpdir(), 'gemini-cli-test-home-'),
|
||||
);
|
||||
(os.homedir as Mock).mockReturnValue(tempHomeDir);
|
||||
(pathsHomedir as Mock).mockReturnValue(tempHomeDir);
|
||||
accountsFile = () =>
|
||||
path.join(tempHomeDir, GEMINI_DIR, 'google_accounts.json');
|
||||
userAccountManager = new UserAccountManager();
|
||||
|
||||
Reference in New Issue
Block a user