From 3d7f5bae9596fa4da87f897e1b735094fb005559 Mon Sep 17 00:00:00 2001 From: VOIDXAI Date: Tue, 31 Mar 2026 11:38:00 +0800 Subject: [PATCH] tests: derive repo roots from test file locations --- tests/commands.test.mjs | 3 ++- tests/runtime.test.mjs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/commands.test.mjs b/tests/commands.test.mjs index a00e8dd..809fdff 100644 --- a/tests/commands.test.mjs +++ b/tests/commands.test.mjs @@ -2,8 +2,9 @@ import fs from "node:fs"; import path from "node:path"; import test from "node:test"; import assert from "node:assert/strict"; +import { fileURLToPath } from "node:url"; -const ROOT = "/Users/dkundel/code/codex-plugin"; +const ROOT = path.resolve(fileURLToPath(new URL("..", import.meta.url))); const PLUGIN_ROOT = path.join(ROOT, "plugins", "codex"); function read(relativePath) { diff --git a/tests/runtime.test.mjs b/tests/runtime.test.mjs index 43ed17c..15f96c5 100644 --- a/tests/runtime.test.mjs +++ b/tests/runtime.test.mjs @@ -3,13 +3,14 @@ import path from "node:path"; import test from "node:test"; import assert from "node:assert/strict"; import { spawn } from "node:child_process"; +import { fileURLToPath } from "node:url"; import { buildEnv, installFakeCodex } from "./fake-codex-fixture.mjs"; import { initGitRepo, makeTempDir, run } from "./helpers.mjs"; import { loadBrokerSession } from "../plugins/codex/scripts/lib/broker-lifecycle.mjs"; import { resolveStateDir } from "../plugins/codex/scripts/lib/state.mjs"; -const ROOT = "/Users/dkundel/code/codex-plugin"; +const ROOT = path.resolve(fileURLToPath(new URL("..", import.meta.url))); const PLUGIN_ROOT = path.join(ROOT, "plugins", "codex"); const SCRIPT = path.join(PLUGIN_ROOT, "scripts", "codex-companion.mjs"); const STOP_HOOK = path.join(PLUGIN_ROOT, "scripts", "stop-review-gate-hook.mjs");