From 5ec55fc718b7761398fa1f30ad23b73222e9343b Mon Sep 17 00:00:00 2001 From: Spencer Date: Fri, 27 Feb 2026 22:32:15 +0000 Subject: [PATCH] test(sandbox): add comment explaining lack of vi.restoreAllMocks() --- packages/cli/src/utils/sandbox.test.ts | 3 +++ packages/core/src/utils/constants.ts | 1 + 2 files changed, 4 insertions(+) diff --git a/packages/cli/src/utils/sandbox.test.ts b/packages/cli/src/utils/sandbox.test.ts index 75128457bb..cfb9e21787 100644 --- a/packages/cli/src/utils/sandbox.test.ts +++ b/packages/cli/src/utils/sandbox.test.ts @@ -122,6 +122,9 @@ describe('sandbox', () => { }); afterEach(() => { + // Note: We intentionally avoid vi.restoreAllMocks() here because it clears the top-level + // vi.mock('@google/gemini-cli-core') entirely, making its un-exported constants (like GEMINI_DIR) + // undefined in subsequent tests. Call counts are still reset by clearAllMocks() in beforeEach. process.env = originalEnv; process.argv = originalArgv; }); diff --git a/packages/core/src/utils/constants.ts b/packages/core/src/utils/constants.ts index 5806dc8443..0a725cc3e4 100644 --- a/packages/core/src/utils/constants.ts +++ b/packages/core/src/utils/constants.ts @@ -10,3 +10,4 @@ export const REFERENCE_CONTENT_END = '--- End of content ---'; export const LOCAL_DEV_SANDBOX_IMAGE_NAME = 'gemini-cli-sandbox'; export const SANDBOX_NETWORK_NAME = 'gemini-cli-sandbox'; export const SANDBOX_PROXY_NAME = 'gemini-cli-sandbox-proxy'; +export const GEMINI_DIR = '.gemini';