Files
orca/src/shared/local-windows-terminal-runtime.test.ts
T
OrcaWinandm4air b4d5b7de7a fix(terminal): honor the OpenSSH DefaultShell on Windows SSH hosts running orcad (#27085)
* fix(terminal): honor the OpenSSH DefaultShell on Windows SSH hosts running orcad (#9327)

* fix(terminal): honor only a PowerShell-family DefaultShell so agent launch quoting still matches

* fix(terminal): import the registry reader's runner from @orca/process-host

* test(terminal): type the spawnSync stub's options

---------

Co-authored-by: m4air <m4air@m4airs-MacBook-Air.local>
2026-10-09 19:53:58 -07:00

51 lines
1.9 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { resolveLocalWindowsTerminalRuntimeOptions } from './local-windows-terminal-runtime'
const LOGIN_SHELL = 'C:\\Program Files\\PowerShell\\7\\pwsh.exe'
function shellFor(args: {
requested?: string
setting?: string
hostProjectRuntime?: boolean
sshLoginShell?: string
}): string | undefined {
return resolveLocalWindowsTerminalRuntimeOptions({
requestedShellOverride: args.requested,
settings: { terminalWindowsShell: args.setting, terminalWindowsWslDistro: null },
projectRuntime: args.hostProjectRuntime
? {
status: 'resolved',
runtime: {
kind: 'windows-host',
hostPlatform: 'win32',
projectId: 'p',
reason: 'global-default',
cacheKey: 'k'
}
}
: undefined,
fallbackHostShell: 'C:\\Windows\\System32\\cmd.exe',
sshLoginShell: args.sshLoginShell
}).shellOverride
}
describe('resolveLocalWindowsTerminalRuntimeOptions: OpenSSH login shell', () => {
it('outranks the shipped PowerShell default and an unset setting', () => {
expect(shellFor({ setting: 'powershell.exe', sshLoginShell: LOGIN_SHELL })).toBe(LOGIN_SHELL)
expect(shellFor({ sshLoginShell: LOGIN_SHELL })).toBe(LOGIN_SHELL)
expect(shellFor({ hostProjectRuntime: true, sshLoginShell: LOGIN_SHELL })).toBe(LOGIN_SHELL)
})
it('yields to a per-tab request and to a non-default host setting', () => {
expect(shellFor({ requested: 'powershell.exe', sshLoginShell: LOGIN_SHELL })).toBe(
'powershell.exe'
)
expect(shellFor({ setting: 'cmd.exe', sshLoginShell: LOGIN_SHELL })).toBe('cmd.exe')
})
it('changes nothing without a login shell', () => {
expect(shellFor({ setting: 'powershell.exe' })).toBe('powershell.exe')
expect(shellFor({ hostProjectRuntime: true })).toBe('C:\\Windows\\System32\\cmd.exe')
})
})