fix(installer): improve Windows compatibility for shell detection and paths

Closes #461
This commit is contained in:
YeonGyu-Kim
2026-02-24 21:42:04 +09:00
parent 55b9ad60d8
commit 6ba1d675b9
10 changed files with 234 additions and 18 deletions
@@ -0,0 +1,39 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test"
import { findBashPath } from "./shell-path"
describe("shell-path", () => {
let originalPlatform: NodeJS.Platform
let originalComspec: string | undefined
beforeEach(() => {
originalPlatform = process.platform
originalComspec = process.env.COMSPEC
})
afterEach(() => {
Object.defineProperty(process, "platform", { value: originalPlatform })
if (originalComspec !== undefined) {
process.env.COMSPEC = originalComspec
return
}
delete process.env.COMSPEC
})
test("#given Windows platform with COMSPEC #when findBashPath is called #then returns COMSPEC path", () => {
Object.defineProperty(process, "platform", { value: "win32" })
process.env.COMSPEC = "C:\\Windows\\System32\\cmd.exe"
const result = findBashPath()
expect(result).toBe("C:\\Windows\\System32\\cmd.exe")
})
test("#given Windows platform without COMSPEC #when findBashPath is called #then returns default cmd path", () => {
Object.defineProperty(process, "platform", { value: "win32" })
delete process.env.COMSPEC
const result = findBashPath()
expect(result).toBe("C:\\Windows\\System32\\cmd.exe")
})
})