From 355f5c070d301c9299b7450049df9e918875fa1a Mon Sep 17 00:00:00 2001 From: jacob314 Date: Mon, 2 Mar 2026 12:22:11 -0800 Subject: [PATCH] test(cli): fix flaky QuotaDisplay snapshot and env leakage in StatusDisplay --- .github/workflows/ci.yml | 2 +- packages/cli/src/config/policy.test.ts | 1 - .../cli/src/ui/components/Footer.test.tsx | 4 +- .../src/ui/components/QuotaDisplay.test.tsx | 18 ++- .../cli/src/ui/components/QuotaDisplay.tsx | 42 +++---- .../cli/src/ui/components/QuotaStatsInfo.tsx | 25 ++-- .../src/ui/components/StatsDisplay.test.tsx | 14 +-- .../cli/src/ui/components/StatsDisplay.tsx | 111 ++++++++++++++---- .../__snapshots__/Footer.test.tsx.snap | 4 +- .../__snapshots__/QuotaDisplay.test.tsx.snap | 14 +-- .../__snapshots__/StatsDisplay.test.tsx.snap | 24 ++-- .../ui/components/messages/ToolMessage.tsx | 3 + .../src/ui/components/messages/ToolShared.tsx | 4 + packages/cli/src/ui/hooks/toolMapping.test.ts | 1 - packages/cli/src/ui/hooks/useToolScheduler.ts | 28 ++--- packages/cli/src/ui/types.ts | 1 + packages/cli/src/ui/utils/displayUtils.ts | 19 +++ packages/cli/src/ui/utils/formatters.ts | 46 +++++--- .../core/src/policy/policy-engine.test.ts | 2 - packages/core/src/tools/mcp-client.test.ts | 1 - 20 files changed, 246 insertions(+), 118 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a358ad8b07..973d88f5f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -169,7 +169,7 @@ jobs: npm run test:ci --workspace @google/gemini-cli else # Explicitly list non-cli packages to ensure they are sharded correctly - npm run test:ci --workspace @google/gemini-cli-core --workspace @google/gemini-cli-a2a-server --workspace gemini-cli-vscode-ide-companion --workspace @google/gemini-cli-test-utils --if-present + npm run test:ci --workspace @google/gemini-cli-core --workspace @google/gemini-cli-a2a-server --workspace gemini-cli-vscode-ide-companion --workspace @google/gemini-cli-test-utils --if-present -- --coverage.enabled=false npm run test:scripts fi diff --git a/packages/cli/src/config/policy.test.ts b/packages/cli/src/config/policy.test.ts index 9baccd3359..8d368bfb91 100644 --- a/packages/cli/src/config/policy.test.ts +++ b/packages/cli/src/config/policy.test.ts @@ -183,7 +183,6 @@ describe('resolveWorkspacePolicyState', () => { setAutoAcceptWorkspacePolicies(originalValue); } }); - it('should not return workspace policies if cwd is the home directory', async () => { const policiesDir = path.join(tempDir, '.gemini', 'policies'); fs.mkdirSync(policiesDir, { recursive: true }); diff --git a/packages/cli/src/ui/components/Footer.test.tsx b/packages/cli/src/ui/components/Footer.test.tsx index b79b005d85..f2b8193865 100644 --- a/packages/cli/src/ui/components/Footer.test.tsx +++ b/packages/cli/src/ui/components/Footer.test.tsx @@ -235,8 +235,8 @@ describe('