Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

test: isolate HOME in state-store CLI tests

Karim Farahat3ebc9bd3d2de
diff --git a/tests/lib/state-store.test.js b/tests/lib/state-store.test.js
index 80ac95ec9..bf0a26c09 100644
--- a/tests/lib/state-store.test.js
+++ b/tests/lib/state-store.test.js
@@ -38,12 +38,19 @@ function cleanupTempDir(dirPath) {
fs.rmSync(dirPath, { recursive: true, force: true });
}
+// The status CLI reconciles install-state found under $HOME, so CLI runs get an
+// empty home instead of the developer's real ~/.claude.
+const ISOLATED_HOME = createTempDir('ecc-state-home-');
+process.on('exit', () => cleanupTempDir(ISOLATED_HOME));
+
function runNode(scriptPath, args = [], options = {}) {
return spawnSync('node', [scriptPath, ...args], {
encoding: 'utf8',
cwd: options.cwd || process.cwd(),
env: {
...process.env,
+ HOME: ISOLATED_HOME,
+ USERPROFILE: ISOLATED_HOME,
...(options.env || {}),
},
});