Skip to content

Commit c91560e

Browse files
authored
🤖 refactor: rename CMUX_TEST_ROOT to CMUX_ROOT (#576)
Renames `CMUX_TEST_ROOT` to `CMUX_ROOT` for clearer intent. This environment variable overrides the default cmux data directory and is useful beyond just testing scenarios (e.g., when developers want to run with a clean slate or isolate different development environments). ## Changes - `CMUX_TEST_ROOT` → `CMUX_ROOT` in all references (`paths.ts`, `main-desktop.ts`, `electronTest.ts`) - Updated comments to match the new name ## Behavior No behavior changes - this is purely a rename: - `make start` still uses `~/.cmux-dev` (via `NODE_ENV=development`, behavior from #573) - Packaged apps still use `~/.cmux` - `CMUX_ROOT=/custom/path` still overrides everything The rename clarifies that this variable isn't just for tests - developers can use it anytime they want explicit control over the data directory. _Generated with `cmux`_
1 parent 43bce08 commit c91560e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/constants/paths.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { join } from "path";
33

44
/**
55
* Get the root directory for all cmux configuration and data.
6-
* Can be overridden with CMUX_TEST_ROOT environment variable.
6+
* Can be overridden with CMUX_ROOT environment variable.
77
* Appends '-dev' suffix when NODE_ENV=development (explicit dev mode).
88
*
99
* This is a getter function to support test mocking of os.homedir().
@@ -13,9 +13,9 @@ import { join } from "path";
1313
*/
1414
export function getCmuxHome(): string {
1515
// eslint-disable-next-line no-restricted-syntax, no-restricted-globals
16-
if (process.env.CMUX_TEST_ROOT) {
16+
if (process.env.CMUX_ROOT) {
1717
// eslint-disable-next-line no-restricted-syntax, no-restricted-globals
18-
return process.env.CMUX_TEST_ROOT;
18+
return process.env.CMUX_ROOT;
1919
}
2020

2121
const baseName = ".cmux";

src/main-desktop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const forceDistLoad = process.env.CMUX_E2E_LOAD_DIST === "1";
7575

7676
if (isE2ETest) {
7777
// For e2e tests, use a test-specific userData directory
78-
// Note: getCmuxHome() already respects CMUX_TEST_ROOT for test isolation
78+
// Note: getCmuxHome() already respects CMUX_ROOT for test isolation
7979
const e2eUserData = path.join(getCmuxHome(), "user-data");
8080
try {
8181
fs.mkdirSync(e2eUserData, { recursive: true });

tests/e2e/electronTest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function buildTarget(target: string): void {
8888

8989
export const electronTest = base.extend<ElectronFixtures>({
9090
workspace: async ({}, use, testInfo) => {
91-
const envRoot = process.env.CMUX_TEST_ROOT ?? "";
91+
const envRoot = process.env.CMUX_ROOT ?? "";
9292
const baseRoot = envRoot || defaultTestRoot;
9393
const uniqueTestId = testInfo.testId || testInfo.title || `test-${Date.now()}`;
9494
const testRoot = envRoot ? baseRoot : path.join(baseRoot, sanitizeForPath(uniqueTestId));
@@ -195,7 +195,7 @@ export const electronTest = base.extend<ElectronFixtures>({
195195
}
196196
electronEnv.ELECTRON_DISABLE_SECURITY_WARNINGS = "true";
197197
electronEnv.CMUX_MOCK_AI = electronEnv.CMUX_MOCK_AI ?? "1";
198-
electronEnv.CMUX_TEST_ROOT = configRoot;
198+
electronEnv.CMUX_ROOT = configRoot;
199199
electronEnv.CMUX_E2E = "1";
200200
electronEnv.CMUX_E2E_LOAD_DIST = shouldLoadDist ? "1" : "0";
201201
electronEnv.VITE_DISABLE_MERMAID = "1";

0 commit comments

Comments
 (0)