fix: set USERPROFILE in tests for Windows os.homedir() compatibility

On Windows, os.homedir() uses USERPROFILE env var instead of HOME.
Tests that override HOME to a temp dir must also set USERPROFILE for
the session-manager, session-aliases, and session-start hook tests
to find files in the correct directory.
This commit is contained in:
Affaan Mustafa
2026-02-12 16:41:58 -08:00
parent 40b354a202
commit dc9aefbee1
3 changed files with 21 additions and 6 deletions

View File

@@ -110,7 +110,7 @@ async function runTests() {
fs.mkdirSync(path.join(isoHome, '.claude', 'skills', 'learned'), { recursive: true });
try {
const result = await runScript(path.join(scriptsDir, 'session-start.js'), '', {
HOME: isoHome
HOME: isoHome, USERPROFILE: isoHome
});
assert.strictEqual(result.code, 0, `Exit code should be 0, got ${result.code}`);
} finally {
@@ -138,7 +138,7 @@ async function runTests() {
try {
const result = await runScript(path.join(scriptsDir, 'session-start.js'), '', {
HOME: isoHome
HOME: isoHome, USERPROFILE: isoHome
});
assert.strictEqual(result.code, 0);
// stdout should NOT contain the template content
@@ -163,7 +163,7 @@ async function runTests() {
try {
const result = await runScript(path.join(scriptsDir, 'session-start.js'), '', {
HOME: isoHome
HOME: isoHome, USERPROFILE: isoHome
});
assert.strictEqual(result.code, 0);
assert.ok(
@@ -191,7 +191,7 @@ async function runTests() {
try {
const result = await runScript(path.join(scriptsDir, 'session-start.js'), '', {
HOME: isoHome
HOME: isoHome, USERPROFILE: isoHome
});
assert.strictEqual(result.code, 0);
assert.ok(