Use IdeClient directly instead of config.ideClient (#7627)

This commit is contained in:
Tommaso Sciortino
2025-09-04 09:32:09 -07:00
committed by GitHub
parent 45d494a8d8
commit cb43bb9ca4
24 changed files with 288 additions and 217 deletions

View File

@@ -16,7 +16,19 @@ import { formatMemoryUsage } from '../utils/formatters.js';
vi.mock('open');
vi.mock('../../utils/version.js');
vi.mock('../utils/formatters.js');
vi.mock('@google/gemini-cli-core');
vi.mock('@google/gemini-cli-core', async (importOriginal) => {
const actual =
await importOriginal<typeof import('@google/gemini-cli-core')>();
return {
...actual,
IdeClient: {
getInstance: () => ({
getDetectedIdeDisplayName: vi.fn().mockReturnValue('VSCode'),
}),
},
sessionId: 'test-session-id',
};
});
vi.mock('node:process', () => ({
default: {
platform: 'test-platform',
@@ -31,9 +43,6 @@ describe('bugCommand', () => {
beforeEach(() => {
vi.mocked(getCliVersion).mockResolvedValue('0.1.0');
vi.mocked(formatMemoryUsage).mockReturnValue('100 MB');
vi.mock('@google/gemini-cli-core', () => ({
sessionId: 'test-session-id',
}));
vi.stubEnv('SANDBOX', 'gemini-test');
});
@@ -48,9 +57,6 @@ describe('bugCommand', () => {
config: {
getModel: () => 'gemini-pro',
getBugCommand: () => undefined,
getIdeClient: () => ({
getDetectedIdeDisplayName: () => 'VSCode',
}),
getIdeMode: () => true,
},
},
@@ -84,9 +90,6 @@ describe('bugCommand', () => {
config: {
getModel: () => 'gemini-pro',
getBugCommand: () => ({ urlTemplate: customTemplate }),
getIdeClient: () => ({
getDetectedIdeDisplayName: () => 'VSCode',
}),
getIdeMode: () => true,
},
},