mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 00:22:34 +00:00
fix(codex): prefer cmd wrappers over powershell on windows
- keep Windows Codex detection on the npm cmd shim when available - add regression tests for cmd-first and ps1-to-cmd fallback selection
This commit is contained in:
@@ -73,7 +73,7 @@ describe('codex-detector', () => {
|
||||
execFileSyncSpy.mockRestore();
|
||||
});
|
||||
|
||||
it('prefers a sibling PowerShell wrapper over cmd when Windows PATH only exposes codex.cmd', () => {
|
||||
it('keeps the cmd wrapper when Windows PATH exposes codex.cmd and a sibling ps1 also exists', () => {
|
||||
const fakeCmdCodex = path.join(tmpDir, 'codex.cmd');
|
||||
const fakePsCodex = path.join(tmpDir, 'codex.ps1');
|
||||
fs.writeFileSync(fakeCmdCodex, '');
|
||||
@@ -82,7 +82,21 @@ describe('codex-detector', () => {
|
||||
|
||||
const execSyncSpy = spyOn(childProcess, 'execSync').mockImplementation(() => `${fakeCmdCodex}\n`);
|
||||
|
||||
expect(detectCodexCli()).toBe(fakePsCodex);
|
||||
expect(detectCodexCli()).toBe(fakeCmdCodex);
|
||||
|
||||
execSyncSpy.mockRestore();
|
||||
});
|
||||
|
||||
it('replaces a Windows PowerShell wrapper with a sibling cmd shim when PATH returns codex.ps1', () => {
|
||||
const fakeCmdCodex = path.join(tmpDir, 'codex.cmd');
|
||||
const fakePsCodex = path.join(tmpDir, 'codex.ps1');
|
||||
fs.writeFileSync(fakeCmdCodex, '');
|
||||
fs.writeFileSync(fakePsCodex, '');
|
||||
Object.defineProperty(process, 'platform', { value: 'win32' });
|
||||
|
||||
const execSyncSpy = spyOn(childProcess, 'execSync').mockImplementation(() => `${fakePsCodex}\n`);
|
||||
|
||||
expect(detectCodexCli()).toBe(fakeCmdCodex);
|
||||
|
||||
execSyncSpy.mockRestore();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user