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