From 0b2bc3d651d882ca8ba2d848097290f39042e7a4 Mon Sep 17 00:00:00 2001 From: Yichen Jiang Date: Mon, 17 Aug 2026 15:18:24 +0800 Subject: [PATCH] fix(llm-pi-ai): stub both home spellings in the tilde-expansion test os.homedir() reads HOME on POSIX and USERPROFILE on Windows; stubbing only HOME left the Windows lane expanding ~ into the real profile directory and failing the fileExists assertions. --- packages/llm/llm-pi-ai/tests/auth.spec.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/llm/llm-pi-ai/tests/auth.spec.ts b/packages/llm/llm-pi-ai/tests/auth.spec.ts index fa6c635c86..27a496a2c3 100644 --- a/packages/llm/llm-pi-ai/tests/auth.spec.ts +++ b/packages/llm/llm-pi-ai/tests/auth.spec.ts @@ -158,7 +158,10 @@ describe('pi-ai ambient auth context', () => { const dir = await mkdtemp(join(tmpdir(), 'dsh-pi-home-')) dirs.push(dir) await writeFile(join(dir, 'creds'), 'x') + // Both spellings of "home": os.homedir() reads HOME on POSIX and + // USERPROFILE on Windows, and the expansion under test goes through it. vi.stubEnv('HOME', dir) + vi.stubEnv('USERPROFILE', dir) const context = authContextFrom(await stored()) await expect(context.fileExists('~/creds')).resolves.toBe(true)