extract console error to util func (#11675)

This commit is contained in:
Abhi
2025-10-22 16:09:10 -04:00
committed by GitHub
parent a7faa2080f
commit b40f67b76a
9 changed files with 19 additions and 63 deletions

View File

@@ -224,37 +224,11 @@ const TOOLS_SHELL_FAKE_SCHEMA: SettingsSchemaType = {
},
} as unknown as SettingsSchemaType;
// Helper function to simulate key presses (commented out for now)
// const simulateKeyPress = async (keyData: Partial<Key> & { name: string }) => {
// if (currentKeypressHandler) {
// const key: Key = {
// ctrl: false,
// meta: false,
// shift: false,
// paste: false,
// sequence: keyData.sequence || keyData.name,
// ...keyData,
// };
// currentKeypressHandler(key);
// // Allow React to process the state update
// await new Promise(resolve => setTimeout(resolve, 10));
// }
// };
// Mock console.log to avoid noise in tests
// const originalConsoleLog = console.log;
// const originalConsoleError = console.error;
describe('SettingsDialog', () => {
// Simple delay function for remaining tests that need gradual migration
const wait = (ms = 50) => new Promise((resolve) => setTimeout(resolve, ms));
beforeEach(() => {
// Reset keypress mock state (variables are commented out)
// currentKeypressHandler = null;
// isKeypressActive = false;
// console.log = vi.fn();
// console.error = vi.fn();
mockToggleVimEnabled.mockResolvedValue(true);
});
@@ -262,11 +236,6 @@ describe('SettingsDialog', () => {
TEST_ONLY.clearFlattenedSchema();
vi.clearAllMocks();
vi.resetAllMocks();
// Reset keypress mock state (variables are commented out)
// currentKeypressHandler = null;
// isKeypressActive = false;
// console.log = originalConsoleLog;
// console.error = originalConsoleError;
});
describe('Initial Rendering', () => {

View File

@@ -21,6 +21,7 @@ import {
MINIMUM_MAX_HEIGHT,
} from '../components/shared/MaxSizedBox.js';
import type { LoadedSettings } from '../../config/settings.js';
import { debugLogger } from '@google/gemini-cli-core';
// Configure theming and parsing utilities.
const lowlight = createLowlight(common);
@@ -191,7 +192,7 @@ export function colorizeCode(
</MaxSizedBox>
);
} catch (error) {
console.error(
debugLogger.warn(
`[colorizeCode] Error highlighting code for language "${language}":`,
error,
);

View File

@@ -158,7 +158,7 @@ class GeminiAgent {
);
isAuthenticated = true;
} catch (e) {
console.error(`Authentication failed: ${e}`);
debugLogger.error(`Authentication failed: ${e}`);
}
}
@@ -660,7 +660,7 @@ class Session {
);
}
} catch (globError) {
console.error(
debugLogger.error(
`Error during glob search for ${pathName}: ${getErrorMessage(globError)}`,
);
}
@@ -670,7 +670,7 @@ class Session {
);
}
} else {
console.error(
debugLogger.error(
`Error stating path ${pathName}. Path ${pathName} will be skipped.`,
);
}