mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
refactor(ide): Improve IDE detection discovery (#6765)
This commit is contained in:
@@ -24,7 +24,7 @@ describe.skip('IdeClient', () => {
|
||||
process.env['GEMINI_CLI_IDE_WORKSPACE_PATH'] = process.cwd();
|
||||
process.env['TERM_PROGRAM'] = 'vscode';
|
||||
|
||||
const ideClient = IdeClient.getInstance();
|
||||
const ideClient = await IdeClient.getInstance();
|
||||
await ideClient.connect();
|
||||
|
||||
expect(ideClient.getConnectionStatus()).toEqual({
|
||||
@@ -67,7 +67,8 @@ describe('IdeClient fallback connection logic', () => {
|
||||
process.env['TERM_PROGRAM'] = 'vscode';
|
||||
process.env['GEMINI_CLI_IDE_WORKSPACE_PATH'] = process.cwd();
|
||||
// Reset instance
|
||||
IdeClient.instance = undefined;
|
||||
(IdeClient as unknown as { instance: IdeClient | undefined }).instance =
|
||||
undefined;
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -85,7 +86,7 @@ describe('IdeClient fallback connection logic', () => {
|
||||
fs.unlinkSync(portFile);
|
||||
}
|
||||
|
||||
const ideClient = IdeClient.getInstance();
|
||||
const ideClient = await IdeClient.getInstance();
|
||||
await ideClient.connect();
|
||||
|
||||
expect(ideClient.getConnectionStatus()).toEqual({
|
||||
@@ -99,7 +100,7 @@ describe('IdeClient fallback connection logic', () => {
|
||||
// Write port file with a port that is not listening
|
||||
fs.writeFileSync(portFile, JSON.stringify({ port: filePort }));
|
||||
|
||||
const ideClient = IdeClient.getInstance();
|
||||
const ideClient = await IdeClient.getInstance();
|
||||
await ideClient.connect();
|
||||
|
||||
expect(ideClient.getConnectionStatus()).toEqual({
|
||||
@@ -110,7 +111,7 @@ describe('IdeClient fallback connection logic', () => {
|
||||
});
|
||||
|
||||
describe.skip('getIdeProcessId', () => {
|
||||
let child: ChildProcess;
|
||||
let child: child_process.ChildProcess;
|
||||
|
||||
afterEach(() => {
|
||||
if (child) {
|
||||
@@ -173,11 +174,12 @@ describe('IdeClient with proxy', () => {
|
||||
vi.stubEnv('GEMINI_CLI_IDE_WORKSPACE_PATH', process.cwd());
|
||||
|
||||
// Reset instance
|
||||
IdeClient.instance = undefined;
|
||||
(IdeClient as unknown as { instance: IdeClient | undefined }).instance =
|
||||
undefined;
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
IdeClient.getInstance().disconnect();
|
||||
(await IdeClient.getInstance()).disconnect();
|
||||
await mcpServer.stop();
|
||||
proxyServer.close();
|
||||
vi.unstubAllEnvs();
|
||||
@@ -188,7 +190,7 @@ describe('IdeClient with proxy', () => {
|
||||
vi.stubEnv('HTTPS_PROXY', `http://localhost:${proxyServerPort}`);
|
||||
vi.stubEnv('NO_PROXY', 'example.com,127.0.0.1,::1');
|
||||
|
||||
const ideClient = IdeClient.getInstance();
|
||||
const ideClient = await IdeClient.getInstance();
|
||||
await ideClient.connect();
|
||||
|
||||
expect(ideClient.getConnectionStatus()).toEqual({
|
||||
|
||||
Reference in New Issue
Block a user