diff --git a/test/helpers/session-runner.ts b/test/helpers/session-runner.ts index 6654df5f..99c17669 100644 --- a/test/helpers/session-runner.ts +++ b/test/helpers/session-runner.ts @@ -155,10 +155,16 @@ export async function runSkillTest(options: { const promptFile = path.join(workingDirectory, '.prompt-tmp'); fs.writeFileSync(promptFile, prompt); + // Isolate telemetry: E2E tests use a temp state dir so they don't pollute + // production telemetry with test events (e.g. fake timeout crashes). + const testStateDir = path.join(os.tmpdir(), `gstack-e2e-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`); + fs.mkdirSync(testStateDir, { recursive: true }); + const proc = Bun.spawn(['sh', '-c', `cat "${promptFile}" | claude ${args.map(a => `"${a}"`).join(' ')}`], { cwd: workingDirectory, stdout: 'pipe', stderr: 'pipe', + env: { ...process.env, GSTACK_STATE_DIR: testStateDir }, }); // Race against timeout