mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
@@ -37,7 +37,7 @@ describe('Configuration Integration Tests', () => {
|
|||||||
let originalEnv: NodeJS.ProcessEnv;
|
let originalEnv: NodeJS.ProcessEnv;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
tempDir = fs.mkdtempSync(path.join(tmpdir(), 'gemini-cli-test-'));
|
tempDir = fs.mkdtempSync(path.join(tmpdir(), 'qwen-code-test-'));
|
||||||
originalEnv = { ...process.env };
|
originalEnv = { ...process.env };
|
||||||
process.env.GEMINI_API_KEY = 'test-api-key';
|
process.env.GEMINI_API_KEY = 'test-api-key';
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ describe('loadExtensions', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
tempWorkspaceDir = fs.mkdtempSync(
|
tempWorkspaceDir = fs.mkdtempSync(
|
||||||
path.join(os.tmpdir(), 'gemini-cli-test-workspace-'),
|
path.join(os.tmpdir(), 'qwen-code-test-workspace-'),
|
||||||
);
|
);
|
||||||
tempHomeDir = fs.mkdtempSync(
|
tempHomeDir = fs.mkdtempSync(
|
||||||
path.join(os.tmpdir(), 'gemini-cli-test-home-'),
|
path.join(os.tmpdir(), 'qwen-code-test-home-'),
|
||||||
);
|
);
|
||||||
vi.mocked(os.homedir).mockReturnValue(tempHomeDir);
|
vi.mocked(os.homedir).mockReturnValue(tempHomeDir);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import os from 'os';
|
|||||||
import { join as pathJoin } from 'node:path';
|
import { join as pathJoin } from 'node:path';
|
||||||
import { getErrorMessage } from '@qwen-code/qwen-code-core';
|
import { getErrorMessage } from '@qwen-code/qwen-code-core';
|
||||||
|
|
||||||
const warningsFilePath = pathJoin(os.tmpdir(), 'gemini-cli-warnings.txt');
|
const warningsFilePath = pathJoin(os.tmpdir(), 'qwen-code-warnings.txt');
|
||||||
|
|
||||||
export async function getStartupWarnings(): Promise<string[]> {
|
export async function getStartupWarnings(): Promise<string[]> {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ describe('oauth2', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
tempHomeDir = fs.mkdtempSync(
|
tempHomeDir = fs.mkdtempSync(
|
||||||
path.join(os.tmpdir(), 'gemini-cli-test-home-'),
|
path.join(os.tmpdir(), 'qwen-code-test-home-'),
|
||||||
);
|
);
|
||||||
(os.homedir as Mock).mockReturnValue(tempHomeDir);
|
(os.homedir as Mock).mockReturnValue(tempHomeDir);
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ describe('Server Config (config.ts)', () => {
|
|||||||
const MODEL = 'gemini-pro';
|
const MODEL = 'gemini-pro';
|
||||||
const SANDBOX: SandboxConfig = {
|
const SANDBOX: SandboxConfig = {
|
||||||
command: 'docker',
|
command: 'docker',
|
||||||
image: 'gemini-cli-sandbox',
|
image: 'qwen-code-sandbox',
|
||||||
};
|
};
|
||||||
const TARGET_DIR = '/path/to/target';
|
const TARGET_DIR = '/path/to/target';
|
||||||
const DEBUG_MODE = false;
|
const DEBUG_MODE = false;
|
||||||
|
|||||||
@@ -586,7 +586,7 @@ export async function connectToMcpServer(
|
|||||||
debugMode: boolean,
|
debugMode: boolean,
|
||||||
): Promise<Client> {
|
): Promise<Client> {
|
||||||
const mcpClient = new Client({
|
const mcpClient = new Client({
|
||||||
name: 'gemini-cli-mcp-client',
|
name: 'qwen-code-mcp-client',
|
||||||
version: '0.0.1',
|
version: '0.0.1',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ describe('modifyWithEditor', () => {
|
|||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
vi.restoreAllMocks();
|
vi.restoreAllMocks();
|
||||||
await fsp.rm(testProjectDir, { recursive: true, force: true });
|
await fsp.rm(testProjectDir, { recursive: true, force: true });
|
||||||
const diffDir = path.join(os.tmpdir(), 'gemini-cli-tool-modify-diffs');
|
const diffDir = path.join(os.tmpdir(), 'qwen-code-tool-modify-diffs');
|
||||||
await fsp.rm(diffDir, { recursive: true, force: true });
|
await fsp.rm(diffDir, { recursive: true, force: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ describe('modifyWithEditor', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should create temp directory if it does not exist', async () => {
|
it('should create temp directory if it does not exist', async () => {
|
||||||
const diffDir = path.join(os.tmpdir(), 'gemini-cli-tool-modify-diffs');
|
const diffDir = path.join(os.tmpdir(), 'qwen-code-tool-modify-diffs');
|
||||||
await fsp.rm(diffDir, { recursive: true, force: true }).catch(() => {});
|
await fsp.rm(diffDir, { recursive: true, force: true }).catch(() => {});
|
||||||
|
|
||||||
await modifyWithEditor(
|
await modifyWithEditor(
|
||||||
@@ -155,7 +155,7 @@ describe('modifyWithEditor', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should not create temp directory if it already exists', async () => {
|
it('should not create temp directory if it already exists', async () => {
|
||||||
const diffDir = path.join(os.tmpdir(), 'gemini-cli-tool-modify-diffs');
|
const diffDir = path.join(os.tmpdir(), 'qwen-code-tool-modify-diffs');
|
||||||
await fsp.mkdir(diffDir, { recursive: true });
|
await fsp.mkdir(diffDir, { recursive: true });
|
||||||
|
|
||||||
const mkdirSpy = vi.spyOn(fs, 'mkdirSync');
|
const mkdirSpy = vi.spyOn(fs, 'mkdirSync');
|
||||||
@@ -294,10 +294,10 @@ describe('modifyWithEditor', () => {
|
|||||||
|
|
||||||
expect(mockOpenDiff).toHaveBeenCalledOnce();
|
expect(mockOpenDiff).toHaveBeenCalledOnce();
|
||||||
const [oldFilePath, newFilePath] = mockOpenDiff.mock.calls[0];
|
const [oldFilePath, newFilePath] = mockOpenDiff.mock.calls[0];
|
||||||
expect(oldFilePath).toMatch(/gemini-cli-modify-test-file-old-\d+\.txt$/);
|
expect(oldFilePath).toMatch(/qwen-code-modify-test-file-old-\d+\.txt$/);
|
||||||
expect(newFilePath).toMatch(/gemini-cli-modify-test-file-new-\d+\.txt$/);
|
expect(newFilePath).toMatch(/qwen-code-modify-test-file-new-\d+\.txt$/);
|
||||||
|
|
||||||
const diffDir = path.join(os.tmpdir(), 'gemini-cli-tool-modify-diffs');
|
const diffDir = path.join(os.tmpdir(), 'qwen-code-tool-modify-diffs');
|
||||||
expect(path.dirname(oldFilePath)).toBe(diffDir);
|
expect(path.dirname(oldFilePath)).toBe(diffDir);
|
||||||
expect(path.dirname(newFilePath)).toBe(diffDir);
|
expect(path.dirname(newFilePath)).toBe(diffDir);
|
||||||
});
|
});
|
||||||
@@ -315,10 +315,10 @@ describe('modifyWithEditor', () => {
|
|||||||
|
|
||||||
expect(mockOpenDiff).toHaveBeenCalledOnce();
|
expect(mockOpenDiff).toHaveBeenCalledOnce();
|
||||||
const [oldFilePath, newFilePath] = mockOpenDiff.mock.calls[0];
|
const [oldFilePath, newFilePath] = mockOpenDiff.mock.calls[0];
|
||||||
expect(oldFilePath).toMatch(/gemini-cli-modify-test-file-old-\d+$/);
|
expect(oldFilePath).toMatch(/qwen-code-modify-test-file-old-\d+$/);
|
||||||
expect(newFilePath).toMatch(/gemini-cli-modify-test-file-new-\d+$/);
|
expect(newFilePath).toMatch(/qwen-code-modify-test-file-new-\d+$/);
|
||||||
|
|
||||||
const diffDir = path.join(os.tmpdir(), 'gemini-cli-tool-modify-diffs');
|
const diffDir = path.join(os.tmpdir(), 'qwen-code-tool-modify-diffs');
|
||||||
expect(path.dirname(oldFilePath)).toBe(diffDir);
|
expect(path.dirname(oldFilePath)).toBe(diffDir);
|
||||||
expect(path.dirname(newFilePath)).toBe(diffDir);
|
expect(path.dirname(newFilePath)).toBe(diffDir);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ function createTempFilesForModify(
|
|||||||
file_path: string,
|
file_path: string,
|
||||||
): { oldPath: string; newPath: string } {
|
): { oldPath: string; newPath: string } {
|
||||||
const tempDir = os.tmpdir();
|
const tempDir = os.tmpdir();
|
||||||
const diffDir = path.join(tempDir, 'gemini-cli-tool-modify-diffs');
|
const diffDir = path.join(tempDir, 'qwen-code-tool-modify-diffs');
|
||||||
|
|
||||||
if (!fs.existsSync(diffDir)) {
|
if (!fs.existsSync(diffDir)) {
|
||||||
fs.mkdirSync(diffDir, { recursive: true });
|
fs.mkdirSync(diffDir, { recursive: true });
|
||||||
@@ -62,11 +62,11 @@ function createTempFilesForModify(
|
|||||||
const timestamp = Date.now();
|
const timestamp = Date.now();
|
||||||
const tempOldPath = path.join(
|
const tempOldPath = path.join(
|
||||||
diffDir,
|
diffDir,
|
||||||
`gemini-cli-modify-${fileName}-old-${timestamp}${ext}`,
|
`qwen-code-modify-${fileName}-old-${timestamp}${ext}`,
|
||||||
);
|
);
|
||||||
const tempNewPath = path.join(
|
const tempNewPath = path.join(
|
||||||
diffDir,
|
diffDir,
|
||||||
`gemini-cli-modify-${fileName}-new-${timestamp}${ext}`,
|
`qwen-code-modify-${fileName}-new-${timestamp}${ext}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
fs.writeFileSync(tempOldPath, currentContent, 'utf8');
|
fs.writeFileSync(tempOldPath, currentContent, 'utf8');
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import {
|
|||||||
} from '../utils/editCorrector.js';
|
} from '../utils/editCorrector.js';
|
||||||
import { createMockWorkspaceContext } from '../test-utils/mockWorkspaceContext.js';
|
import { createMockWorkspaceContext } from '../test-utils/mockWorkspaceContext.js';
|
||||||
|
|
||||||
const rootDir = path.resolve(os.tmpdir(), 'gemini-cli-test-root');
|
const rootDir = path.resolve(os.tmpdir(), 'qwen-code-test-root');
|
||||||
|
|
||||||
// --- MOCKS ---
|
// --- MOCKS ---
|
||||||
vi.mock('../core/client.js');
|
vi.mock('../core/client.js');
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ describe('user_account', () => {
|
|||||||
path.join(tempHomeDir, '.qwen', 'google_accounts.json');
|
path.join(tempHomeDir, '.qwen', 'google_accounts.json');
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
tempHomeDir = fs.mkdtempSync(
|
tempHomeDir = fs.mkdtempSync(
|
||||||
path.join(os.tmpdir(), 'gemini-cli-test-home-'),
|
path.join(os.tmpdir(), 'qwen-code-test-home-'),
|
||||||
);
|
);
|
||||||
(os.homedir as Mock).mockReturnValue(tempHomeDir);
|
(os.homedir as Mock).mockReturnValue(tempHomeDir);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ export class IDEServer {
|
|||||||
const createMcpServer = (diffManager: DiffManager) => {
|
const createMcpServer = (diffManager: DiffManager) => {
|
||||||
const server = new McpServer(
|
const server = new McpServer(
|
||||||
{
|
{
|
||||||
name: 'gemini-cli-companion-mcp-server',
|
name: 'qwen-code-companion-mcp-server',
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
},
|
},
|
||||||
{ capabilities: { logging: {} } },
|
{ capabilities: { logging: {} } },
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const filesToWatch = [
|
|||||||
path.join(cliPackageDir, 'tsconfig.json'),
|
path.join(cliPackageDir, 'tsconfig.json'),
|
||||||
]; // Specific files within the CLI package
|
]; // Specific files within the CLI package
|
||||||
const buildDir = path.join(cliPackageDir, 'dist'); // Build output directory within the CLI package
|
const buildDir = path.join(cliPackageDir, 'dist'); // Build output directory within the CLI package
|
||||||
const warningsFilePath = path.join(os.tmpdir(), 'gemini-cli-warnings.txt'); // Temp file for warnings
|
const warningsFilePath = path.join(os.tmpdir(), 'qwen-code-warnings.txt'); // Temp file for warnings
|
||||||
// ---------------------
|
// ---------------------
|
||||||
|
|
||||||
function getMtime(filePath) {
|
function getMtime(filePath) {
|
||||||
|
|||||||
@@ -41,11 +41,11 @@ export const WORKSPACE_SETTINGS_FILE = path.join(
|
|||||||
export function getJson(url) {
|
export function getJson(url) {
|
||||||
const tmpFile = path.join(
|
const tmpFile = path.join(
|
||||||
os.tmpdir(),
|
os.tmpdir(),
|
||||||
`gemini-cli-releases-${Date.now()}.json`,
|
`qwen-code-releases-${Date.now()}.json`,
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
execSync(
|
execSync(
|
||||||
`curl -sL -H "User-Agent: gemini-cli-dev-script" -o "${tmpFile}" "${url}"`,
|
`curl -sL -H "User-Agent: qwen-code-dev-script" -o "${tmpFile}" "${url}"`,
|
||||||
{ stdio: 'pipe' },
|
{ stdio: 'pipe' },
|
||||||
);
|
);
|
||||||
const content = fs.readFileSync(tmpFile, 'utf-8');
|
const content = fs.readFileSync(tmpFile, 'utf-8');
|
||||||
@@ -242,9 +242,7 @@ export async function ensureBinary(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const downloadUrl = asset.browser_download_url;
|
const downloadUrl = asset.browser_download_url;
|
||||||
const tmpDir = fs.mkdtempSync(
|
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'qwen-code-telemetry-'));
|
||||||
path.join(os.tmpdir(), 'gemini-cli-telemetry-'),
|
|
||||||
);
|
|
||||||
const archivePath = path.join(tmpDir, asset.name);
|
const archivePath = path.join(tmpDir, asset.name);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user