/** * Copyright (c) 2026, Salesforce, Inc., * All rights reserved. * For full license text, see the LICENSE.txt file */ import fs from "node:fs"; import os from "node:os"; import path from "node:path"; // Redirect session storage to a temp dir so tests never pollute ~/.graphiti/sessions. const TEST_SESSIONS_DIR = fs.mkdtempSync(path.join(os.tmpdir(), "graphiti-test-")); process.env.GRAPHITI_SESSIONS_DIR = TEST_SESSIONS_DIR; // Redirect HOME so anything reading os.homedir() at module load (introspect.ts, // object-info.ts, auth.ts) lands under a temp dir instead of the developer's // real ~/.graphiti. const TEST_HOME = fs.mkdtempSync(path.join(os.tmpdir(), "graphiti-home-")); process.env.HOME = TEST_HOME;