Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
"install:codex": "node scripts/installer-cli.mjs install",
"prepack": "npm run check:version-sync && npm run check:changelog",
"setup:git-hooks": "node scripts/setup-git-hooks.mjs",
"test": "node --test tests/*.test.mjs",
"test:cross-platform": "node --test tests/args.test.mjs tests/changelog.test.mjs tests/claude-cli.test.mjs tests/fs.test.mjs tests/prompts.test.mjs tests/render.test.mjs tests/sandbox-modes.test.mjs tests/skills-contracts.test.mjs tests/structured-output.test.mjs tests/version-sync.test.mjs",
"test": "node --import ./tests/support/isolated-codex-home.mjs --test tests/*.test.mjs",
"test:cross-platform": "node --import ./tests/support/isolated-codex-home.mjs --test tests/args.test.mjs tests/changelog.test.mjs tests/claude-cli.test.mjs tests/fs.test.mjs tests/prompts.test.mjs tests/render.test.mjs tests/sandbox-modes.test.mjs tests/skills-contracts.test.mjs tests/structured-output.test.mjs tests/version-sync.test.mjs",
"test:integration": "node --test tests/integration/*.test.mjs",
"test:e2e": "node --test tests/e2e/*.test.mjs",
"uninstall:codex": "node scripts/installer-cli.mjs uninstall",
Expand Down
21 changes: 21 additions & 0 deletions tests/support/isolated-codex-home.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright 2026 Sendbird, Inc.
* SPDX-License-Identifier: Apache-2.0
*/
// Preloaded by the unit test scripts with `node --import`, which also applies it
// to every test file's process. Plugin state defaults to ~/.codex, so without
// this the tests that create jobs write into the developer's real Codex plugin
// data. Each process gets its own throwaway home. Tests that need a specific
// layout still pass their own HOME or CODEX_HOME to the processes they spawn.
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import process from "node:process";

const home = fs.mkdtempSync(path.join(os.tmpdir(), "cc-plugin-codex-test-home-"));
process.env.HOME = home;
process.env.USERPROFILE = home;
delete process.env.CODEX_HOME;
process.on("exit", () => {
fs.rmSync(home, { recursive: true, force: true });
});