Files
scriptc/packages/runtime/test/node-island-host.test.ts
T
Malte UblandClaude Opus 5.5 5fa44d9243 Share modules between a program and its Node islands through loader hooks (NI-6)
Node islands stack, part 5 of 11 (scriptc-perf/results/islands-prs/PLAN.md).

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

14 lines
700 B
TypeScript

import { readFileSync } from "node:fs";
import { join } from "node:path";
import { expect, test } from "vitest";
import { renderHeader } from "../../../scripts/node-island-host.mjs";
const srcDir = join(import.meta.dirname, "../src");
// scr_node_island.c starts `node -e` with the host embedded in this header;
// a host edit without regenerating it would ship the old host.
test("the embedded Node island host matches its source", () => {
const source = `${readFileSync(join(srcDir, "scr_node_island_host.cjs"), "utf8")}\n${readFileSync(join(srcDir, "scr_node_island_hooks.cjs"), "utf8")}`;
expect(readFileSync(join(srcDir, "scr_node_island_host.h"), "utf8")).toBe(renderHeader(source));
});