Files
openclaw/test/scripts/compiled-tooling.process.test.ts
Peter Steinberger 2a911a7ccb fix: keep cold child compilation outside CI test deadlines (#156011)
* test: prepare bounded TypeScript child probes

Prepare native test children through the invocation-owned compiler before their existing deadlines. Preserve module boundaries for import guards and script entry detection, and keep source-loader contracts explicit.

Retain native process isolation, worker lifetimes, assertions, and deadlines. Cover MTS declaration selection in the existing compiler fixture. Also declare the generated fallback plugin fixture as ESM and remove one unused internal script export.

* test: prepare remaining worker and tooling fixtures

Keep installed tooling at its native package location so prepared probes retain native bindings and relative assets. Preserve existing child deadlines, assertions, and source-layout contracts.

* test: assert native CLI delegation before option rejection

* test: preserve sparse prepared fixture entry contracts

* test: mark prepared budget fixtures as ES modules

* test: preserve serialized fixture inputs under type-aware lint

* test: prepare sparse wrapper and report fixtures

* test: prepare remaining CLI wrapper children

* test: complete bounded child fixture preparation
2026-09-22 17:41:19 -07:00

38 lines
1.4 KiB
TypeScript

import { afterEach, expect, it } from "vitest";
import { scriptModuleEntrypoints } from "../../scripts/script-module-runtime.test-support.mjs";
import {
resolveRuntimeWorkerArgv,
resolveRuntimeWorkerUrl,
} from "../../src/infra/runtime-worker-url.js";
import { resolveTestNodeExecPath } from "../../src/test-utils/node-process.js";
import { runNodeScript } from "../helpers/run-node-script.js";
import { useAutoCleanupTempDirTracker } from "../helpers/temp-dir.js";
const tempDirs = useAutoCleanupTempDirTracker(afterEach);
it("loads installed tooling when the prepared CLI validates native Vitest options", async ({
signal,
}) => {
const directory = tempDirs.make("openclaw-compiled-tooling-");
const result = await runNodeScript(
[
...resolveRuntimeWorkerArgv(
resolveRuntimeWorkerUrl(scriptModuleEntrypoints.testProjects),
resolveTestNodeExecPath(),
),
"test/scripts/test-projects.test.ts",
"--",
"--invalid-native-vitest-option",
],
{ ...process.env, TMPDIR: directory, TMP: directory, TEMP: directory },
5_000,
{ signal, requireProcessTreeExit: process.platform !== "win32" },
);
expect(result.error, result.stderr).toBeUndefined();
expect(result.status).toBe(1);
expect(result.stderr).toContain("Unknown option");
expect(result.stderr).toContain("invalid");
expect(result.stderr).toContain("[test] starting ");
});