Skip to content

fix(tests): fix pre-existing CLI test failures blocking CI#4

Closed
mabry1985 wants to merge 1 commit into
mainfrom
fix/pre-existing-test-failures
Closed

fix(tests): fix pre-existing CLI test failures blocking CI#4
mabry1985 wants to merge 1 commit into
mainfrom
fix/pre-existing-test-failures

Conversation

@mabry1985

@mabry1985 mabry1985 commented Apr 2, 2026

Copy link
Copy Markdown

Summary

  • useFocus (2 tests): update expected escape sequences to include synchronous output mode wrapper (\x1b[?2026h...\x1b[?2026l) added to the hook after the tests were written
  • AppContainer terminal title (6 tests): same sync mode wrapper update on all title write assertions
  • Header ASCII logo (1 test): update assertion from Gemini box-drawing chars (██╔═══██╗) to proto's TeX-style logo (/\\ \\__)
  • useGeminiStream (2 tests): add missing drainQueuedMessages arg to all 21 direct useGeminiStream() callsites; add getTool to getToolRegistry mock; explicitly export hasFileEdits in the core mock to work around vitest alias resolution gap
  • auth/status (1 test): update expected command string from qwen auth coding-plan to proto auth coding-plan to match the partially-renamed handler

All 14 failures were pre-existing on main before PR #3 — none were introduced by recent changes.

Test plan

  • CI passes (all 9 matrix jobs green)
  • No regressions in other test files

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Adjusted authentication status test expectation for command output.
    • Updated terminal-title and control-sequence expectations across UI tests to reflect wrapped title updates and focus behavior.
    • Revised a wide-terminal header test to expect an updated ASCII logo fragment.
    • Expanded mocks and updated hook invocations for streaming-related tests to match updated runtime behavior.

@coderabbitai

coderabbitai Bot commented Apr 2, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a3e5fe0b-b524-427b-b51a-cb2aa1dc2e92

📥 Commits

Reviewing files that changed from the base of the PR and between cbd72d8 and a2b5944.

📒 Files selected for processing (5)
  • packages/cli/src/commands/auth/status.test.ts
  • packages/cli/src/ui/AppContainer.test.tsx
  • packages/cli/src/ui/components/Header.test.tsx
  • packages/cli/src/ui/hooks/useFocus.test.ts
  • packages/cli/src/ui/hooks/useGeminiStream.test.tsx
✅ Files skipped from review due to trivial changes (2)
  • packages/cli/src/ui/components/Header.test.tsx
  • packages/cli/src/commands/auth/status.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/cli/src/ui/hooks/useFocus.test.ts
  • packages/cli/src/ui/AppContainer.test.tsx
  • packages/cli/src/ui/hooks/useGeminiStream.test.tsx

Walkthrough

Updated 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

Cohort / File(s) Summary
Auth status & Header text
packages/cli/src/commands/auth/status.test.ts, packages/cli/src/ui/components/Header.test.tsx
String expectations changed: command text now expects proto auth coding-plan (was qwen auth coding-plan); ASCII logo fragment expectation changed to /\\ \\__ (replacing ██╔═══██╗).
OSC title & focus escape sequences
packages/cli/src/ui/AppContainer.test.tsx, packages/cli/src/ui/hooks/useFocus.test.ts
Tests now expect DEC private-mode wrap (\x1b[?2026h ... \x1b[?2026l) around OSC title updates and focus-reporting sequences. Assertions updated to include these prefix/suffix bytes.
Gemini stream mocks & hook signature
packages/cli/src/ui/hooks/useGeminiStream.test.tsx
Test mocks extended: added hasFileEdits: vi.fn(() => false) to @qwen-code/qwen-code-core; mockConfig.getToolRegistry returns getToolSchemaList and getTool; all useGeminiStream(...) test calls now include an extra final arg () => [].

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing pre-existing CLI test failures that were blocking CI.
Description check ✅ Passed The description provides a clear summary and test plan, but is missing several template sections (TLDR, Screenshots, Dive Deeper, Testing Matrix, and Linked issues).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pre-existing-test-failures

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 | 🔴 Critical

Missing drainQueuedMessages argument will cause test failure.

This useGeminiStream call has only 18 arguments but the hook requires 19 parameters. The drainQueuedMessages: () => 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

📥 Commits

Reviewing files that changed from the base of the PR and between 6ab2e17 and cbd72d8.

📒 Files selected for processing (5)
  • packages/cli/src/commands/auth/status.test.ts
  • packages/cli/src/ui/AppContainer.test.tsx
  • packages/cli/src/ui/components/Header.test.tsx
  • packages/cli/src/ui/hooks/useFocus.test.ts
  • packages/cli/src/ui/hooks/useGeminiStream.test.tsx

@github-actions

github-actions Bot commented Apr 2, 2026

Copy link
Copy Markdown

Code Coverage Summary

Package Lines Statements Functions Branches
CLI N/A% N/A% N/A% N/A%
Core N/A% N/A% N/A% N/A%
CLI Package - Full Text Report
CLI full-text-summary.txt not found at: coverage_artifact/cli/coverage/full-text-summary.txt
Core Package - Full Text Report
Core full-text-summary.txt not found at: coverage_artifact/core/coverage/full-text-summary.txt

For 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>
@mabry1985 mabry1985 force-pushed the fix/pre-existing-test-failures branch from cbd72d8 to a2b5944 Compare April 2, 2026 17:11
@mabry1985

Copy link
Copy Markdown
Author

Superseded by #5 which includes all CLI fixes from this PR plus the full core package test sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant