- shell-env: detect Git Bash via MSYSTEM env var when SHELL is unset (#3366) On some Git Bash installations SHELL is not set but MSYSTEM (MINGW64/MSYS) is always present. Check MSYSTEM before PSModulePath to avoid emitting PowerShell syntax in bash shells. - session-state: resolve legacy agent names in resolveRegisteredAgentName (#3272) Historical sessions stored agent names like 'Sisyphus (Ultraworker)' which don't match the current registered format. Fall back to getAgentConfigKey for legacy/parenthesized name resolution before returning the raw name. - config-migration: skip backup when file content is unchanged (#3222) Compare serialized config with existing file content before creating a timestamped .bak file. Only create backup when the on-disk content actually differs from the migrated content.
This commit is contained in:
@@ -10,6 +10,7 @@ describe("shell-env", () => {
|
||||
originalEnv = {
|
||||
SHELL: process.env.SHELL,
|
||||
PSModulePath: process.env.PSModulePath,
|
||||
MSYSTEM: process.env.MSYSTEM,
|
||||
}
|
||||
})
|
||||
|
||||
@@ -47,6 +48,7 @@ describe("shell-env", () => {
|
||||
|
||||
test("#given PSModulePath is set without SHELL #when detectShellType is called #then returns powershell", () => {
|
||||
delete process.env.SHELL
|
||||
delete process.env.MSYSTEM
|
||||
process.env.PSModulePath = "C:\\Program Files\\PowerShell\\Modules"
|
||||
Object.defineProperty(process, "platform", { value: "win32" })
|
||||
|
||||
@@ -58,6 +60,7 @@ describe("shell-env", () => {
|
||||
test("#given Windows platform without PSModulePath #when detectShellType is called #then returns cmd", () => {
|
||||
delete process.env.PSModulePath
|
||||
delete process.env.SHELL
|
||||
delete process.env.MSYSTEM
|
||||
Object.defineProperty(process, "platform", { value: "win32" })
|
||||
|
||||
const result = detectShellType()
|
||||
@@ -68,6 +71,7 @@ describe("shell-env", () => {
|
||||
test("#given non-Windows platform without SHELL env var #when detectShellType is called #then returns unix", () => {
|
||||
delete process.env.PSModulePath
|
||||
delete process.env.SHELL
|
||||
delete process.env.MSYSTEM
|
||||
Object.defineProperty(process, "platform", { value: "linux" })
|
||||
|
||||
const result = detectShellType()
|
||||
@@ -94,6 +98,28 @@ describe("shell-env", () => {
|
||||
|
||||
expect(result).toBe("unix")
|
||||
})
|
||||
|
||||
test("#given MSYSTEM set on Windows without SHELL #when detectShellType is called #then returns unix", () => {
|
||||
delete process.env.SHELL
|
||||
process.env.MSYSTEM = "MINGW64"
|
||||
process.env.PSModulePath = "C:\\Program Files\\PowerShell\\Modules"
|
||||
Object.defineProperty(process, "platform", { value: "win32" })
|
||||
|
||||
const result = detectShellType()
|
||||
|
||||
expect(result).toBe("unix")
|
||||
})
|
||||
|
||||
test("#given MSYSTEM set to MSYS without SHELL #when detectShellType is called #then returns unix", () => {
|
||||
delete process.env.SHELL
|
||||
process.env.MSYSTEM = "MSYS"
|
||||
process.env.PSModulePath = "C:\\Program Files\\PowerShell\\Modules"
|
||||
Object.defineProperty(process, "platform", { value: "win32" })
|
||||
|
||||
const result = detectShellType()
|
||||
|
||||
expect(result).toBe("unix")
|
||||
})
|
||||
})
|
||||
|
||||
describe("shellEscape", () => {
|
||||
|
||||
Reference in New Issue
Block a user