From 218f4ae85f771273e5b02b754cc653f031f1b8d1 Mon Sep 17 00:00:00 2001 From: azank Date: Thu, 15 Oct 2026 19:08:53 +0500 Subject: [PATCH] test(hooks): isolate the no-deps session-start test from NODE_PATH and the context cap A NODE_PATH that exposes js-yaml let the regression pass the test, and an inherited ECC_SESSION_START_MAX_CHARS=0 made it fail falsely. Drop NODE_PATH from the child environment and pin the cap to 8000, as session-start-alias-unavailable.test.js does. --- .../plugin-install-without-node-modules.test.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/scripts/plugin-install-without-node-modules.test.js b/tests/scripts/plugin-install-without-node-modules.test.js index 0ae6790a6..c555ba04a 100644 --- a/tests/scripts/plugin-install-without-node-modules.test.js +++ b/tests/scripts/plugin-install-without-node-modules.test.js @@ -121,11 +121,16 @@ function runTests() { fs.mkdirSync(data, { recursive: true }); fs.writeFileSync(path.join(project, 'pubspec.yaml'), 'name: app\ndependencies:\n flutter:\n sdk: flutter\n'); + const env = { ...process.env, HOME: home, USERPROFILE: home, ECC_AGENT_DATA_HOME: data, + CLAUDE_CONFIG_DIR: data, CLAUDE_PROJECT_DIR: project, XDG_DATA_HOME: path.join(home, '.local', 'share'), + ECC_HOMUNCULUS_DIR: path.join(data, 'homunculus'), ECC_SESSION_START_CONTEXT: 'true', + ECC_SESSION_START_MAX_CHARS: '8000' }; + // A NODE_PATH that exposes js-yaml would hide the missing dependency. + delete env.NODE_PATH; + const result = spawnSync(process.execPath, [path.join(pluginDir, 'scripts', 'hooks', 'session-start.js')], { cwd: project, - env: { ...process.env, HOME: home, USERPROFILE: home, ECC_AGENT_DATA_HOME: data, - CLAUDE_CONFIG_DIR: data, CLAUDE_PROJECT_DIR: project, XDG_DATA_HOME: path.join(home, '.local', 'share'), - ECC_HOMUNCULUS_DIR: path.join(data, 'homunculus'), ECC_SESSION_START_CONTEXT: 'true' }, + env, input: JSON.stringify({ hook_event_name: 'SessionStart', source: 'startup', session_id: 'no-deps', cwd: project }), encoding: 'utf8', timeout: 15000,