Files
scriptc/tests/harness/sandbox-platform.test.ts
T
Malte UblandClaude Opus 5.5 f5a677f086 Forward a configured libnode pack into test:sandbox lanes
The lanes run with CI=1, so the Node island tests require a libnode pack and
fail rather than skip without one. A lane Sandbox prepared from a snapshot
that carries a pack had no way to be told where it is, because the lane
environment pinned only CI, SCRIPTC_SAN and the shard variables. Forward an
explicitly configured SCRIPTC_LIBNODE — a directory inside the Sandbox, never
the host — through sandboxLaneEnv, which every remote lane command already
uses, and document it in the runner's help.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 18:22:56 -07:00

60 lines
1.9 KiB
TypeScript

import { expect, test } from "vitest";
import { sandboxHostSchedule, sandboxLaneEnv } from "../../scripts/sandbox-platform.mjs";
const files = ["native-a.test.ts", "native-b.test.ts"];
test("Darwin runs native files and kqueue contracts locally", () => {
expect(sandboxHostSchedule("darwin", files)).toEqual({
darwinContracts: true,
localArtifactContracts: true,
localInvariantFiles: files,
remoteArtifactContracts: false,
remoteInvariantFiles: [],
});
});
test("Linux runs its supported native files locally without Darwin contracts", () => {
expect(sandboxHostSchedule("linux", files)).toEqual({
darwinContracts: false,
localArtifactContracts: true,
localInvariantFiles: files,
remoteArtifactContracts: false,
remoteInvariantFiles: [],
});
});
test("other hosts retain native-file coverage in Linux Sandboxes", () => {
expect(sandboxHostSchedule("win32", files)).toEqual({
darwinContracts: false,
localArtifactContracts: false,
localInvariantFiles: [],
remoteArtifactContracts: true,
remoteInvariantFiles: files,
});
});
test("lane environments override inherited sanitizer and scheduler settings", () => {
expect(sandboxLaneEnv("plain", {})).toEqual({
CI: "1",
SCRIPTC_PORTABLE_ONLY: "",
SCRIPTC_SAN: "",
SCRIPTC_TEST_SHARD: "",
SCRIPTC_LIBNODE: "",
});
expect(sandboxLaneEnv("san", {})).toEqual({
CI: "1",
SCRIPTC_PORTABLE_ONLY: "",
SCRIPTC_SAN: "1",
SCRIPTC_TEST_SHARD: "",
SCRIPTC_LIBNODE: "",
});
});
test("a lane forwards the libnode pack it is given", () => {
// The path names a pack inside the Sandbox; the island tests require one in
// a CI lane, and a snapshot-provided pack is only found through this.
const pack = "/vercel/sandbox/libnode-pack";
expect(sandboxLaneEnv("plain", { SCRIPTC_LIBNODE: pack }).SCRIPTC_LIBNODE).toBe(pack);
expect(sandboxLaneEnv("san", { SCRIPTC_LIBNODE: pack }).SCRIPTC_LIBNODE).toBe(pack);
});