google-gemini/gemini-cli

test(a2a-server): migrate process.env to vi.stubEnv() per GEMINI.md conventions

已关闭

#19,826 创建于 2026年2月21日

 (8 条评论) (0 个反应) (1 位负责人)TypeScript (13,657 个派生)batch import
Stalearea/platformgood first issuehelp wantedkind/bugkind/customer-issuepriority/p3status/bot-triaged

仓库指标

星标
 (103,992 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Description

Per the testing conventions documented in GEMINI.md:

When testing code that depends on environment variables, use vi.stubEnv('NAME', 'value') in beforeEach and vi.unstubAllEnvs() in afterEach. Avoid modifying process.env directly as it can lead to test leakage and is less reliable.

Several test files in packages/a2a-server/ still use direct process.env manipulation:

  • src/commands/init.test.ts (1 direct assignment)
  • src/config/config.test.ts (~8 direct assignments/deletions)
  • src/http/app.test.ts (3 direct assignments/deletions)

Proposed fix

Replace all direct process.env writes and deletes with vi.stubEnv() / vi.unstubAllEnvs() following the pattern documented in GEMINI.md.

I'd be happy to submit a PR for this.

贡献者指南