test: fix failures due to antigravity environment leakage (#26162)

This commit is contained in:
Adam Weidman
2026-04-29 10:51:43 -04:00
committed by GitHub
parent c2e5b28e94
commit 7ab932c8bf
3 changed files with 5 additions and 0 deletions
@@ -42,10 +42,12 @@ describe('ExtensionManager agents loading', () => {
beforeEach(() => {
vi.clearAllMocks();
vi.stubEnv('ANTIGRAVITY_CLI_ALIAS', '');
vi.spyOn(debugLogger, 'warn').mockImplementation(() => {});
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gemini-test-agents-'));
mockHomedir.mockReturnValue(tempDir);
vi.stubEnv('GEMINI_CLI_HOME', tempDir);
// Create the extensions directory that ExtensionManager expects
extensionsDir = path.join(tempDir, '.gemini', EXTENSIONS_DIRECTORY_NAME);
@@ -48,11 +48,13 @@ describe('ExtensionManager hydration', () => {
beforeEach(() => {
vi.clearAllMocks();
vi.stubEnv('ANTIGRAVITY_CLI_ALIAS', '');
vi.spyOn(coreEvents, 'emitFeedback');
vi.spyOn(debugLogger, 'debug').mockImplementation(() => {});
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gemini-test-'));
mockHomedir.mockReturnValue(tempDir);
vi.stubEnv('GEMINI_CLI_HOME', tempDir);
// Create the extensions directory that ExtensionManager expects
extensionsDir = path.join(tempDir, '.gemini', EXTENSIONS_DIRECTORY_NAME);
@@ -39,6 +39,7 @@ describe('createContentGenerator', () => {
beforeEach(() => {
resetVersionCache();
vi.clearAllMocks();
vi.stubEnv('ANTIGRAVITY_CLI_ALIAS', '');
});
afterEach(() => {