Skip to content

Commit 776c594

Browse files
committed
cover windows codex precedence
1 parent d2c3524 commit 776c594

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

test/codex-bin-wrapper.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,29 @@ describe("codex bin wrapper", () => {
13061306
});
13071307
});
13081308

1309+
it("prefers Windows codex.exe over extensionless codex when both exist", () => {
1310+
const pathEntry = join("C:", "custom", "bin");
1311+
const nativeCodexExePath = join(pathEntry, "codex.exe");
1312+
const nativeCodexPath = join(pathEntry, "codex");
1313+
const resolved = resolveRealCodexBin({
1314+
env: {
1315+
PATH: pathEntry,
1316+
},
1317+
argv: [process.execPath, join(repoRootDir, "scripts", "codex.js")],
1318+
platform: "win32",
1319+
moduleUrl: pathToFileURL(join(repoRootDir, "scripts", "codex.js")).href,
1320+
resolvePackageBin: () => null,
1321+
spawnSyncImpl: () => createSpawnSyncSuccess("") as SpawnSyncReturns<string>,
1322+
existsSyncImpl: (candidate) =>
1323+
candidate === nativeCodexExePath || candidate === nativeCodexPath,
1324+
});
1325+
1326+
expect(resolved).toEqual({
1327+
path: nativeCodexExePath,
1328+
launchWithNode: false,
1329+
});
1330+
});
1331+
13091332
it("skips self-referential codex wrapper entries on PATH before native binaries", () => {
13101333
const wrapperScriptPath = join(
13111334
"C:\\test-root",

0 commit comments

Comments
 (0)