chore: migrate console.error in useGeminiStream (#12157)

Co-authored-by: Hriday Taneja <hridayt@google.com>
This commit is contained in:
hritan
2025-10-28 19:05:48 +00:00
committed by GitHub
parent 7e987113a2
commit e750da987d
2 changed files with 8 additions and 6 deletions
@@ -33,6 +33,7 @@ import {
ToolErrorType,
ToolConfirmationOutcome,
tokenLimit,
debugLogger,
} from '@google/gemini-cli-core';
import type { Part, PartListUnion } from '@google/genai';
import type { UseHistoryManagerReturn } from './useHistoryManager.js';
@@ -1708,8 +1709,8 @@ describe('useGeminiStream', () => {
});
it('should handle errors gracefully when auto-approving tool calls', async () => {
const consoleSpy = vi
.spyOn(console, 'error')
const debuggerSpy = vi
.spyOn(debugLogger, 'warn')
.mockImplementation(() => {});
const mockOnConfirmSuccess = vi.fn().mockResolvedValue(undefined);
const mockOnConfirmError = vi
@@ -1790,12 +1791,12 @@ describe('useGeminiStream', () => {
expect(mockOnConfirmError).toHaveBeenCalledTimes(1);
// Error should be logged
expect(consoleSpy).toHaveBeenCalledWith(
expect(debuggerSpy).toHaveBeenCalledWith(
'Failed to auto-approve tool call call2:',
expect.any(Error),
);
consoleSpy.mockRestore();
debuggerSpy.mockRestore();
});
it('should skip tool calls without confirmationDetails', async () => {