


























@@ -142,6 +142,20 @@ describe("detectGhConfigDirMismatch", () => {
142142});
143143});
144144145+it("respects XDG_CONFIG_HOME before HOME on darwin", () => {
146+const result = detectGhConfigDirMismatch(
147+makeInput({
148+platform: "darwin",
149+env: { HOME: "/Users/agent", XDG_CONFIG_HOME: "/Users/agent/Library/XDG" },
150+fileExists: fileSet("/Users/agent/Library/XDG/gh/hosts.yml"),
151+}),
152+);
153+expect(result).toEqual({
154+kind: "auth-discoverable",
155+effectiveConfigDir: "/Users/agent/Library/XDG/gh",
156+});
157+});
158+145159it("uses HOME/.config/gh on darwin (matches gh's documented macOS lookup)", () => {
146160const result = detectGhConfigDirMismatch(
147161makeInput({
@@ -173,6 +187,37 @@ describe("detectGhConfigDirMismatch", () => {
173187});
174188});
175189190+it("respects XDG_CONFIG_HOME before APPDATA on win32", () => {
191+const result = detectGhConfigDirMismatch(
192+makeInput({
193+platform: "win32",
194+env: {
195+XDG_CONFIG_HOME: "C:\\Users\\agent\\XDG",
196+APPDATA: "C:\\Users\\agent\\AppData\\Roaming",
197+},
198+fileExists: fileSet("C:\\Users\\agent\\XDG\\gh\\hosts.yml"),
199+}),
200+);
201+expect(result).toMatchObject({
202+kind: "auth-discoverable",
203+effectiveConfigDir: "C:\\Users\\agent\\XDG\\gh",
204+});
205+});
206+207+it("falls back to HOME/.config/gh on win32 when APPDATA and USERPROFILE are missing", () => {
208+const result = detectGhConfigDirMismatch(
209+makeInput({
210+platform: "win32",
211+env: { HOME: "C:\\Users\\agent" },
212+fileExists: fileSet("C:\\Users\\agent\\.config\\gh\\hosts.yml"),
213+}),
214+);
215+expect(result).toMatchObject({
216+kind: "auth-discoverable",
217+effectiveConfigDir: "C:\\Users\\agent\\.config\\gh",
218+});
219+});
220+176221it("respects an explicit candidateOperatorHomes list", () => {
177222const result = detectGhConfigDirMismatch(
178223makeInput({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。