mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 01:07:46 +00:00
Improve user-facing error messages for IDE mode (#5522)
This commit is contained in:
@@ -45,32 +45,6 @@ describe('ide-installer', () => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
describe('isInstalled', () => {
|
||||
it('should return true if command is in PATH', async () => {
|
||||
expect(await installer.isInstalled()).toBe(true);
|
||||
});
|
||||
|
||||
it('should return true if command is in a known location', async () => {
|
||||
vi.spyOn(child_process, 'execSync').mockImplementation(() => {
|
||||
throw new Error('Command not found');
|
||||
});
|
||||
vi.spyOn(fs, 'existsSync').mockReturnValue(true);
|
||||
// Re-create the installer so it re-runs findVsCodeCommand
|
||||
installer = getIdeInstaller(DetectedIde.VSCode)!;
|
||||
expect(await installer.isInstalled()).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false if command is not found', async () => {
|
||||
vi.spyOn(child_process, 'execSync').mockImplementation(() => {
|
||||
throw new Error('Command not found');
|
||||
});
|
||||
vi.spyOn(fs, 'existsSync').mockReturnValue(false);
|
||||
// Re-create the installer so it re-runs findVsCodeCommand
|
||||
installer = getIdeInstaller(DetectedIde.VSCode)!;
|
||||
expect(await installer.isInstalled()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('install', () => {
|
||||
it('should return a failure message if VS Code is not installed', async () => {
|
||||
vi.spyOn(child_process, 'execSync').mockImplementation(() => {
|
||||
@@ -81,9 +55,7 @@ describe('ide-installer', () => {
|
||||
installer = getIdeInstaller(DetectedIde.VSCode)!;
|
||||
const result = await installer.install();
|
||||
expect(result.success).toBe(false);
|
||||
expect(result.message).toContain(
|
||||
'not found in your PATH or common installation locations',
|
||||
);
|
||||
expect(result.message).toContain('VS Code CLI not found');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user