mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
Node islands stack, part 5 of 11 (scriptc-perf/results/islands-prs/PLAN.md). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
14 lines
700 B
TypeScript
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));
|
|
});
|