From a1852fef33f305e0f0b0fadb7020192f39e5c46a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Mari=C3=B1o?= Date: Fri, 20 Mar 2026 14:56:28 +0100 Subject: [PATCH] fix(tests): add USERPROFILE override for Windows HOME sandboxing On Windows, os.homedir() reads USERPROFILE instead of HOME. The 6 tests using { HOME: tmpDir } to sandbox ~/.gsd/ lookups failed on windows-latest because the child process still resolved homedir to the real user profile. Pass USERPROFILE alongside HOME in all sandboxed test calls. --- tests/config.test.cjs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/config.test.cjs b/tests/config.test.cjs index 0ec5659ec..3a981ba7b 100644 --- a/tests/config.test.cjs +++ b/tests/config.test.cjs @@ -83,7 +83,7 @@ describe('config-ensure-section command', () => { fs.mkdirSync(gsdDir, { recursive: true }); fs.writeFileSync(path.join(gsdDir, 'brave_api_key'), 'test-key', 'utf-8'); - const result = runGsdTools('config-ensure-section', tmpDir, { HOME: tmpDir }); + const result = runGsdTools('config-ensure-section', tmpDir, { HOME: tmpDir, USERPROFILE: tmpDir }); assert.ok(result.success, `Command failed: ${result.error}`); const config = readConfig(tmpDir); @@ -100,7 +100,7 @@ describe('config-ensure-section command', () => { commit_docs: false, }), 'utf-8'); - const result = runGsdTools('config-ensure-section', tmpDir, { HOME: tmpDir }); + const result = runGsdTools('config-ensure-section', tmpDir, { HOME: tmpDir, USERPROFILE: tmpDir }); assert.ok(result.success, `Command failed: ${result.error}`); const config = readConfig(tmpDir); @@ -119,7 +119,7 @@ describe('config-ensure-section command', () => { workflow: { research: false }, }), 'utf-8'); - const result = runGsdTools('config-ensure-section', tmpDir, { HOME: tmpDir }); + const result = runGsdTools('config-ensure-section', tmpDir, { HOME: tmpDir, USERPROFILE: tmpDir }); assert.ok(result.success, `Command failed: ${result.error}`); const config = readConfig(tmpDir); @@ -340,7 +340,7 @@ describe('config-new-project command', () => { model_profile: 'balanced', workflow: { research: true, plan_check: true, verifier: true, nyquist_validation: true }, }); - const result = runGsdTools(['config-new-project', choices], tmpDir, { HOME: tmpDir }); + const result = runGsdTools(['config-new-project', choices], tmpDir, { HOME: tmpDir, USERPROFILE: tmpDir }); assert.ok(result.success, `Command failed: ${result.error}`); const config = readConfig(tmpDir); @@ -388,7 +388,7 @@ describe('config-new-project command', () => { model_profile: 'quality', workflow: { research: false, plan_check: false, verifier: true, nyquist_validation: false }, }); - const result = runGsdTools(['config-new-project', choices], tmpDir, { HOME: tmpDir }); + const result = runGsdTools(['config-new-project', choices], tmpDir, { HOME: tmpDir, USERPROFILE: tmpDir }); assert.ok(result.success, `Command failed: ${result.error}`); const config = readConfig(tmpDir); @@ -407,7 +407,7 @@ describe('config-new-project command', () => { }); test('works with empty choices — all defaults materialized', () => { - const result = runGsdTools(['config-new-project', '{}'], tmpDir, { HOME: tmpDir }); + const result = runGsdTools(['config-new-project', '{}'], tmpDir, { HOME: tmpDir, USERPROFILE: tmpDir }); assert.ok(result.success, `Command failed: ${result.error}`); const config = readConfig(tmpDir);