diff options
| author | matt korwel <[email protected]> | 2025-06-09 12:19:42 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-09 12:19:42 -0700 |
| commit | 3b943c1582026bdf65feb13a73259ce0e034ab2f (patch) | |
| tree | 3368aa85053b8599fe1fb1349383736890ea73e0 /packages/core/src/utils/editor.test.ts | |
| parent | 2182a1cd2cb83071b9defad2314a689d773363e7 (diff) | |
Windows: Refactor Shell Scripts to Node.js for Cross-Platform Compatibility (#784)
Diffstat (limited to 'packages/core/src/utils/editor.test.ts')
| -rw-r--r-- | packages/core/src/utils/editor.test.ts | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/packages/core/src/utils/editor.test.ts b/packages/core/src/utils/editor.test.ts index 74237c74..20917c0f 100644 --- a/packages/core/src/utils/editor.test.ts +++ b/packages/core/src/utils/editor.test.ts @@ -21,7 +21,11 @@ describe('checkHasEditor', () => { it('should return true for vscode if "code" command exists', () => { (execSync as Mock).mockReturnValue(Buffer.from('/usr/bin/code')); expect(checkHasEditor('vscode')).toBe(true); - expect(execSync).toHaveBeenCalledWith('which code', { stdio: 'ignore' }); + const expectedCommand = + process.platform === 'win32' ? 'where.exe code.cmd' : 'command -v code'; + expect(execSync).toHaveBeenCalledWith(expectedCommand, { + stdio: 'ignore', + }); }); it('should return false for vscode if "code" command does not exist', () => { @@ -34,7 +38,11 @@ describe('checkHasEditor', () => { it('should return true for vim if "vim" command exists', () => { (execSync as Mock).mockReturnValue(Buffer.from('/usr/bin/vim')); expect(checkHasEditor('vim')).toBe(true); - expect(execSync).toHaveBeenCalledWith('which vim', { stdio: 'ignore' }); + const expectedCommand = + process.platform === 'win32' ? 'where.exe vim' : 'command -v vim'; + expect(execSync).toHaveBeenCalledWith(expectedCommand, { + stdio: 'ignore', + }); }); it('should return false for vim if "vim" command does not exist', () => { |
