fix(test): isolate XDG_CONFIG_HOME in Windows CLI tests

Windows CLI tests were not deleting XDG_CONFIG_HOME, making them
fragile in environments where this variable is set. getCliConfigDir()
reads XDG_CONFIG_HOME on all platforms, not just Linux.
This commit is contained in:
acamq
2026-03-15 15:30:52 -06:00
parent f92c0931a3
commit 8470a6bf1f

View File

@@ -183,6 +183,7 @@ describe("opencode-config-dir", () => {
// given opencode CLI binary detected, platform is Windows
Object.defineProperty(process, "platform", { value: "win32" })
delete process.env.APPDATA
delete process.env.XDG_CONFIG_HOME
delete process.env.OPENCODE_CONFIG_DIR
// when getOpenCodeConfigDir is called with binary="opencode"
@@ -197,6 +198,7 @@ describe("opencode-config-dir", () => {
// (regression test: previously would check AppData for existing config)
Object.defineProperty(process, "platform", { value: "win32" })
process.env.APPDATA = "C:\\Users\\TestUser\\AppData\\Roaming"
delete process.env.XDG_CONFIG_HOME
delete process.env.OPENCODE_CONFIG_DIR
// when getOpenCodeConfigDir is called with binary="opencode"