fix: mock path for cross platform compability in test cases

This commit is contained in:
mingholy.lmh
2025-12-01 23:10:05 +08:00
parent 56f61bc0b8
commit 839a1d9d8c

View File

@@ -399,13 +399,15 @@ describe('CLI Path Utilities', () => {
delete process.env['QWEN_CODE_CLI_PATH'];
// Mock fs.existsSync to return true for volta bin
mockFs.existsSync.mockImplementation((path) => {
return path.toString().includes('.volta/bin/qwen');
// Use path.join to match platform-specific path separators
const voltaBinPath = path.join('.volta', 'bin', 'qwen');
mockFs.existsSync.mockImplementation((p) => {
return p.toString().includes(voltaBinPath);
});
const result = findNativeCliPath();
expect(result).toContain('.volta/bin/qwen');
expect(result).toContain(voltaBinPath);
process.env['QWEN_CODE_CLI_PATH'] = originalEnv;
});