diff --git a/tests/hooks/context-gate-ownership.test.js b/tests/hooks/context-gate-ownership.test.js index 33eb4cbae..132b97780 100644 --- a/tests/hooks/context-gate-ownership.test.js +++ b/tests/hooks/context-gate-ownership.test.js @@ -61,7 +61,7 @@ function isProposedPathLine(line) { } function fire(sandbox, extra = {}) { - const input = { cwd: '/tmp/owner-a/project', session_id: 'mysess', transcript_path: sandbox.transcript, ...extra }; + const input = { cwd: path.join(sandbox.root, 'owner-a', 'project'), session_id: 'mysess', transcript_path: sandbox.transcript, ...extra }; const result = spawnSync(process.execPath, [RUNNER, 'user-prompt:context-gate', 'scripts/hooks/context-gate.js', 'standard,strict'], { cwd: REPO_ROOT, env: sandbox.env, @@ -123,7 +123,7 @@ function runTests() { record(test('same-named project roots get distinct proposals', () => { clearResumeDir(sandbox); const a = fire(sandbox); - const b = fire(sandbox, { cwd: '/tmp/owner-b/project' }); + const b = fire(sandbox, { cwd: path.join(sandbox.root, 'owner-b', 'project') }); assert.ok(a.target && b.target, `both fires should propose a destination. Got: ${a.target ? b.text : a.text}`); assert.notStrictEqual(a.target, b.target); })); diff --git a/tests/hooks/context-gate.test.js b/tests/hooks/context-gate.test.js index a3355cd4b..59d835c61 100644 --- a/tests/hooks/context-gate.test.js +++ b/tests/hooks/context-gate.test.js @@ -417,8 +417,8 @@ function runTests() { const ctx = JSON.parse(raw).hookSpecificOutput.additionalContext; return ctx.match(/\S*[/\\]resume[/\\]\S*-test\.md/)[0]; }; - const first = extract(run(inputFor(t, { cwd: '/tmp/ecc-demo-proj' }), { env })); - const second = extract(run(inputFor(t, { cwd: '/tmp/ecc-demo-proj' }), { env })); + const first = extract(run(inputFor(t, { cwd: path.join(FIXTURE_DIR, 'ecc-demo-proj') }), { env })); + const second = extract(run(inputFor(t, { cwd: path.join(FIXTURE_DIR, 'ecc-demo-proj') }), { env })); assert.strictEqual(first, second, 'same session must reuse one checkpoint path (idempotent)'); }) ) @@ -448,8 +448,8 @@ function runTests() { delete process.env.CLAUDE_SESSION_ID; // Two different owners, same basename "project", NO session id. const envEnforce = { ECC_CONTEXT_GATE_MODE: 'enforce' }; - const outA = JSON.parse(run(JSON.stringify({ transcript_path: t, cwd: '/tmp/owner-a/project', prompt: 'go' }), { env: envEnforce })); - const outB = JSON.parse(run(JSON.stringify({ transcript_path: t, cwd: '/tmp/owner-b/project', prompt: 'go' }), { env: envEnforce })); + const outA = JSON.parse(run(JSON.stringify({ transcript_path: t, cwd: path.join(sandbox, 'owner-a', 'project'), prompt: 'go' }), { env: envEnforce })); + const outB = JSON.parse(run(JSON.stringify({ transcript_path: t, cwd: path.join(sandbox, 'owner-b', 'project'), prompt: 'go' }), { env: envEnforce })); for (const out of [outA, outB]) { const ctx = out.hookSpecificOutput.additionalContext; // Enforcement declined: NO checkpoint path is named...