openclaw/src/infra/sqlite-readonly-worker.compile-cache.process.test.ts
Peter Steinberger ee51203de7
fix(test): keep subprocess fixtures consistent across Node and Bun (#163805)
Couple test-worker arguments to the executable selected by the shared subprocess helper and migrate its runtime-dependent callers. Repair command parsing, runtime pinning, worker observation, storage settlement, and cleanup-clock fixtures while preserving their contracts.

Fourteen scoped suites pass on Node 24 and Bun; the Bun readSync gap remains an unchanged stop. Refreshed proof covers 638 passed/1 existing skip on Node and 636 passed/3 existing skips on Bun. P2 review and exact-head ClawSweeper found no actionable defects. Production LOC delta is zero.

The first CI head exposed an inherited UI-validator fixture omission. After incorporating its existing main fix, exact-head CI passed, including the published-driver update job. No same-head retry or admin exception was used.
2026-10-02 15:46:52 -07:00

38 lines
1.5 KiB
TypeScript

import { afterEach, expect, it } from "vitest";
import { createFixtureLifetime } from "../../test/helpers/fixture-lifetime.js";
import { runNodeScript } from "../../test/helpers/run-node-script.js";
import { resolveRuntimeWorkerUrl } from "./runtime-worker-url.js";
import { sqliteReadOnlyCompileCacheParentEntrypoint } from "./sqlite-readonly-worker.compile-cache-runtime.test-support.js";
const fixture = createFixtureLifetime();
afterEach(() => fixture.cleanup());
// The shared cache policy matrix lives in sqlite-worker-store.compile-cache.test.ts.
it.for(["sync", "async", "scoped"] as const)(
"inherits the owned compile cache through the real %s worker",
async (mode, { signal }) => {
const root = fixture.createTempDir("openclaw-sqlite-child-cache-");
const env: NodeJS.ProcessEnv = {
...process.env,
HOME: root,
};
delete env.NODE_COMPILE_CACHE;
delete env.NODE_DISABLE_COMPILE_CACHE;
delete env.NODE_OPTIONS;
const result = await fixture.track(
runNodeScript(
(workerArgv) => [
...workerArgv(resolveRuntimeWorkerUrl(sqliteReadOnlyCompileCacheParentEntrypoint)),
root,
mode,
],
env,
undefined,
{ signal, requireProcessTreeExit: process.platform !== "win32", maxBuffer: 1024 * 1024 },
),
);
expect(result.error, result.stderr).toBeUndefined();
expect(result.status, result.stderr).toBe(0);
expect(result.stdout).toBe("readonly-cache:verified");
},
);