fix(tests): fix pre-existing CLI test failures blocking CI#4
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughUpdated multiple CLI test expectations: adjusted command string, ASCII header fragment, terminal OSC/focus escape sequences, and extended mocks plus updated hook call signatures in gemini stream tests. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/cli/src/ui/hooks/useGeminiStream.test.tsx (1)
2070-2091:⚠️ Potential issue | 🔴 CriticalMissing
drainQueuedMessagesargument will cause test failure.This
useGeminiStreamcall has only 18 arguments but the hook requires 19 parameters. ThedrainQueuedMessages: () => string[]argument is missing, unlike all other call sites that were updated in this PR.🐛 Proposed fix to add the missing argument
const { result } = renderHook(() => useGeminiStream( mockConfig.getGeminiClient() as GeminiClient, [], mockAddItem, mockConfig, mockLoadedSettings, mockOnDebugMessage, mockHandleSlashCommand, false, // shellModeActive vi.fn(), // getPreferredEditor vi.fn(), // onAuthError vi.fn(), // performMemoryRefresh false, // modelSwitched vi.fn(), // setModelSwitched vi.fn(), // onEditorClose vi.fn(), // onCancelSubmit vi.fn(), // setShellInputFocused 80, // terminalWidth 24, // terminalHeight + () => [], // drainQueuedMessages ), );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/cli/src/ui/hooks/useGeminiStream.test.tsx` around lines 2070 - 2091, The test call to useGeminiStream is missing the drainQueuedMessages parameter (expects a () => string[]), causing the arity mismatch; update the renderHook invocation to pass a drainQueuedMessages function (e.g., a mock like vi.fn(() => []) or a simple () => []) as the missing argument so the call supplies all 19 parameters to useGeminiStream and aligns with other updated call sites.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/cli/src/ui/hooks/useGeminiStream.test.tsx`:
- Around line 2070-2091: The test call to useGeminiStream is missing the
drainQueuedMessages parameter (expects a () => string[]), causing the arity
mismatch; update the renderHook invocation to pass a drainQueuedMessages
function (e.g., a mock like vi.fn(() => []) or a simple () => []) as the missing
argument so the call supplies all 19 parameters to useGeminiStream and aligns
with other updated call sites.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ad7dbe5e-a651-469e-9815-0b1a04995ee5
📒 Files selected for processing (5)
packages/cli/src/commands/auth/status.test.tspackages/cli/src/ui/AppContainer.test.tsxpackages/cli/src/ui/components/Header.test.tsxpackages/cli/src/ui/hooks/useFocus.test.tspackages/cli/src/ui/hooks/useGeminiStream.test.tsx
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
- useFocus: wrap expected focus-reporting escapes in sync output mode sequences (\x1b[?2026h...\x1b[?2026l) added after tests were written - AppContainer: same sync mode wrapper on all 6 terminal title assertions - Header: update ASCII logo assertion from Gemini box-drawing chars to proto's TeX-style logo (/\\ \\__) - useGeminiStream: add missing drainQueuedMessages arg (21 callsites) and getTool to getToolRegistry mock; explicitly export hasFileEdits in core mock to resolve vitest alias resolution gap - auth/status: update expected command from 'qwen auth coding-plan' to 'proto auth coding-plan' to match partially-renamed handler Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cbd72d8 to
a2b5944
Compare
|
Superseded by #5 which includes all CLI fixes from this PR plus the full core package test sync. |
Summary
\x1b[?2026h...\x1b[?2026l) added to the hook after the tests were written██╔═══██╗) to proto's TeX-style logo (/\\ \\__)drainQueuedMessagesarg to all 21 directuseGeminiStream()callsites; addgetTooltogetToolRegistrymock; explicitly exporthasFileEditsin the core mock to work around vitest alias resolution gapqwen auth coding-plantoproto auth coding-planto match the partially-renamed handlerAll 14 failures were pre-existing on
mainbefore PR #3 — none were introduced by recent changes.Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit