mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-11 03:43:30 +08:00
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:
@@ -17,7 +17,9 @@ const os = require('os');
|
||||
const tmpHome = path.join(os.tmpdir(), `ecc-alias-test-${Date.now()}`);
|
||||
fs.mkdirSync(path.join(tmpHome, '.claude'), { recursive: true });
|
||||
const origHome = process.env.HOME;
|
||||
const origUserProfile = process.env.USERPROFILE;
|
||||
process.env.HOME = tmpHome;
|
||||
process.env.USERPROFILE = tmpHome; // Windows: os.homedir() uses USERPROFILE
|
||||
|
||||
const aliases = require('../../scripts/lib/session-aliases');
|
||||
|
||||
@@ -496,8 +498,13 @@ function runTests() {
|
||||
assert.ok(data.metadata.lastUpdated);
|
||||
})) passed++; else failed++;
|
||||
|
||||
// Cleanup
|
||||
// Cleanup — restore both HOME and USERPROFILE (Windows)
|
||||
process.env.HOME = origHome;
|
||||
if (origUserProfile !== undefined) {
|
||||
process.env.USERPROFILE = origUserProfile;
|
||||
} else {
|
||||
delete process.env.USERPROFILE;
|
||||
}
|
||||
try {
|
||||
fs.rmSync(tmpHome, { recursive: true, force: true });
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user