diff --git a/packages/core/src/agents/generalist-agent.test.ts b/packages/core/src/agents/generalist-agent.test.ts index efdf705a19..510fad5673 100644 --- a/packages/core/src/agents/generalist-agent.test.ts +++ b/packages/core/src/agents/generalist-agent.test.ts @@ -4,13 +4,22 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { describe, it, expect, vi } from 'vitest'; +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { GeneralistAgent } from './generalist-agent.js'; import { makeFakeConfig } from '../test-utils/config.js'; import type { ToolRegistry } from '../tools/tool-registry.js'; import type { AgentRegistry } from './registry.js'; describe('GeneralistAgent', () => { + beforeEach(() => { + vi.stubEnv('GEMINI_SYSTEM_MD', ''); + vi.stubEnv('GEMINI_WRITE_SYSTEM_MD', ''); + }); + + afterEach(() => { + vi.unstubAllEnvs(); + }); + it('should create a valid generalist agent definition', () => { const config = makeFakeConfig(); vi.spyOn(config, 'getToolRegistry').mockReturnValue({ diff --git a/packages/core/src/prompts/promptProvider.test.ts b/packages/core/src/prompts/promptProvider.test.ts index f286d5bea8..2d96dee7ef 100644 --- a/packages/core/src/prompts/promptProvider.test.ts +++ b/packages/core/src/prompts/promptProvider.test.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { PromptProvider } from './promptProvider.js'; import type { Config } from '../config/config.js'; import { @@ -35,6 +35,9 @@ describe('PromptProvider', () => { beforeEach(() => { vi.resetAllMocks(); + vi.stubEnv('GEMINI_SYSTEM_MD', ''); + vi.stubEnv('GEMINI_WRITE_SYSTEM_MD', ''); + mockConfig = { getToolRegistry: vi.fn().mockReturnValue({ getAllToolNames: vi.fn().mockReturnValue([]), @@ -60,6 +63,10 @@ describe('PromptProvider', () => { } as unknown as Config; }); + afterEach(() => { + vi.unstubAllEnvs(); + }); + it('should handle multiple context filenames in the system prompt', () => { vi.mocked(getAllGeminiMdFilenames).mockReturnValue([ DEFAULT_CONTEXT_FILENAME,