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.
This commit is contained in:
@@ -83,7 +83,7 @@ describe('config-ensure-section command', () => {
|
|||||||
fs.mkdirSync(gsdDir, { recursive: true });
|
fs.mkdirSync(gsdDir, { recursive: true });
|
||||||
fs.writeFileSync(path.join(gsdDir, 'brave_api_key'), 'test-key', 'utf-8');
|
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}`);
|
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||||
|
|
||||||
const config = readConfig(tmpDir);
|
const config = readConfig(tmpDir);
|
||||||
@@ -100,7 +100,7 @@ describe('config-ensure-section command', () => {
|
|||||||
commit_docs: false,
|
commit_docs: false,
|
||||||
}), 'utf-8');
|
}), '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}`);
|
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||||
|
|
||||||
const config = readConfig(tmpDir);
|
const config = readConfig(tmpDir);
|
||||||
@@ -119,7 +119,7 @@ describe('config-ensure-section command', () => {
|
|||||||
workflow: { research: false },
|
workflow: { research: false },
|
||||||
}), 'utf-8');
|
}), '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}`);
|
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||||
|
|
||||||
const config = readConfig(tmpDir);
|
const config = readConfig(tmpDir);
|
||||||
@@ -340,7 +340,7 @@ describe('config-new-project command', () => {
|
|||||||
model_profile: 'balanced',
|
model_profile: 'balanced',
|
||||||
workflow: { research: true, plan_check: true, verifier: true, nyquist_validation: true },
|
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}`);
|
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||||
|
|
||||||
const config = readConfig(tmpDir);
|
const config = readConfig(tmpDir);
|
||||||
@@ -388,7 +388,7 @@ describe('config-new-project command', () => {
|
|||||||
model_profile: 'quality',
|
model_profile: 'quality',
|
||||||
workflow: { research: false, plan_check: false, verifier: true, nyquist_validation: false },
|
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}`);
|
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||||
|
|
||||||
const config = readConfig(tmpDir);
|
const config = readConfig(tmpDir);
|
||||||
@@ -407,7 +407,7 @@ describe('config-new-project command', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('works with empty choices — all defaults materialized', () => {
|
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}`);
|
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||||
|
|
||||||
const config = readConfig(tmpDir);
|
const config = readConfig(tmpDir);
|
||||||
|
|||||||
Reference in New Issue
Block a user