diff --git a/tests/cli/ocx-launcher-source.test.ts b/tests/cli/ocx-launcher-source.test.ts index 2938f1c165e..1dce864c01c 100644 --- a/tests/cli/ocx-launcher-source.test.ts +++ b/tests/cli/ocx-launcher-source.test.ts @@ -67,7 +67,7 @@ describe("ocx.mjs package launcher (source invariants)", () => { // Path and source come from one resolution, so the marker cannot describe another binary. expect(source).toContain("const bunRuntime = resolveBun({ allowInstall: !codexCliUpdateInspection });"); expect(source).toContain("const bun = bunRuntime.path;"); - expect(source).toContain('return { path: bin, source: "bundled" };'); + expect(source).toContain('return { path: bin, source: "bundled", version: bundledBunVersion(bunDir) };'); // The launcher's literal name must match the TypeScript constant it mirrors. expect(runtimeSource).toContain('export const BUN_RUNTIME_SOURCE_ENV = "OCX_BUN_RUNTIME_SOURCE";'); @@ -138,7 +138,8 @@ describe("ocx.mjs package launcher (source invariants)", () => { */ test("the inspection child does not inherit a duplicate copy of the snapshotted values", () => { expect(source).toContain("const inheritedEnv = { ...process.env };"); - expect(source).toContain("...inheritedEnv,"); + // The de-duplicated environment reaches the child; only its transpiler cache is scoped (#7362). + expect(source).toContain("...scopeTranspilerCacheToRuntime(inheritedEnv, bunRuntime.version, join),"); // Windows spells the variable `Path` in practice, so an upper-case-only delete would // leave the duplicate behind. The match must be on the lowercase form of every key. expect(source).toContain("if (snapshotted.has(name.toLowerCase())) delete inheritedEnv[name];"); @@ -153,6 +154,8 @@ describe("ocx.mjs package launcher (source invariants)", () => { const spawnStart = source.indexOf("const child = spawn(bun, [cliPath,"); expect(spawnStart).toBeGreaterThan(-1); expect(source.slice(spawnStart)).not.toContain("...process.env,"); + expect(source.slice(spawnStart, source.indexOf("});", spawnStart))) + .toContain("...scopeTranspilerCacheToRuntime(inheritedEnv, bunRuntime.version, join),"); }); /**