From a0b8dd66a01e66525a50a05696f85428baf50e8f Mon Sep 17 00:00:00 2001 From: Ammar Date: Thu, 13 Nov 2025 10:21:07 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20refactor:=20rename=20CMUX=5FTEST?= =?UTF-8?q?=5FROOT=20to=20CMUX=5FROOT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Renames CMUX_TEST_ROOT to CMUX_ROOT for clearer intent - this env var is not just for tests, but for any scenario where you want to override the default data directory. The -dev suffix behavior from #573 is preserved: - `make start` uses `~/.cmux-dev` (NODE_ENV=development) - Packaged apps use `~/.cmux` - `CMUX_ROOT=/custom/path` overrides both Changes: - Renamed CMUX_TEST_ROOT → CMUX_ROOT in all files - Updated comments to reflect the clearer naming - All existing behavior preserved _Generated with `cmux`_ --- src/constants/paths.ts | 6 +++--- src/main-desktop.ts | 2 +- tests/e2e/electronTest.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/constants/paths.ts b/src/constants/paths.ts index 8232329ad..ec610b7d6 100644 --- a/src/constants/paths.ts +++ b/src/constants/paths.ts @@ -3,7 +3,7 @@ import { join } from "path"; /** * Get the root directory for all cmux configuration and data. - * Can be overridden with CMUX_TEST_ROOT environment variable. + * Can be overridden with CMUX_ROOT environment variable. * Appends '-dev' suffix when NODE_ENV=development (explicit dev mode). * * This is a getter function to support test mocking of os.homedir(). @@ -13,9 +13,9 @@ import { join } from "path"; */ export function getCmuxHome(): string { // eslint-disable-next-line no-restricted-syntax, no-restricted-globals - if (process.env.CMUX_TEST_ROOT) { + if (process.env.CMUX_ROOT) { // eslint-disable-next-line no-restricted-syntax, no-restricted-globals - return process.env.CMUX_TEST_ROOT; + return process.env.CMUX_ROOT; } const baseName = ".cmux"; diff --git a/src/main-desktop.ts b/src/main-desktop.ts index ef8e486dc..5416da7a7 100644 --- a/src/main-desktop.ts +++ b/src/main-desktop.ts @@ -75,7 +75,7 @@ const forceDistLoad = process.env.CMUX_E2E_LOAD_DIST === "1"; if (isE2ETest) { // For e2e tests, use a test-specific userData directory - // Note: getCmuxHome() already respects CMUX_TEST_ROOT for test isolation + // Note: getCmuxHome() already respects CMUX_ROOT for test isolation const e2eUserData = path.join(getCmuxHome(), "user-data"); try { fs.mkdirSync(e2eUserData, { recursive: true }); diff --git a/tests/e2e/electronTest.ts b/tests/e2e/electronTest.ts index ac59f8993..47fa68463 100644 --- a/tests/e2e/electronTest.ts +++ b/tests/e2e/electronTest.ts @@ -88,7 +88,7 @@ function buildTarget(target: string): void { export const electronTest = base.extend({ workspace: async ({}, use, testInfo) => { - const envRoot = process.env.CMUX_TEST_ROOT ?? ""; + const envRoot = process.env.CMUX_ROOT ?? ""; const baseRoot = envRoot || defaultTestRoot; const uniqueTestId = testInfo.testId || testInfo.title || `test-${Date.now()}`; const testRoot = envRoot ? baseRoot : path.join(baseRoot, sanitizeForPath(uniqueTestId)); @@ -195,7 +195,7 @@ export const electronTest = base.extend({ } electronEnv.ELECTRON_DISABLE_SECURITY_WARNINGS = "true"; electronEnv.CMUX_MOCK_AI = electronEnv.CMUX_MOCK_AI ?? "1"; - electronEnv.CMUX_TEST_ROOT = configRoot; + electronEnv.CMUX_ROOT = configRoot; electronEnv.CMUX_E2E = "1"; electronEnv.CMUX_E2E_LOAD_DIST = shouldLoadDist ? "1" : "0"; electronEnv.VITE_DISABLE_MERMAID = "1";