import { mkdtemp, rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { pathToFileURL } from "node:url"; import { build } from "../scripts/build.mjs"; import test from "node:test"; import assert from "node:assert/strict"; import { readFile, readdir } from "node:fs/promises"; const root = new URL("../", import.meta.url); test("portable build isolates runtime output and preserves authored source", async (t) => { const before = await readFile(new URL("src/page.html", root), "utf8"); const output = await mkdtemp(join(tmpdir(), "dualentry-build-")); t.after(() => rm(output, { recursive: true, force: true })); const generated = pathToFileURL(output + "/"); await build(output); assert.equal(await readFile(new URL("src/page.html", root), "utf8"), before); const html = await readFile(new URL("index.html", generated), "utf8"); assert.equal((html.match(/rel="stylesheet"/g) || []).length, 1); assert.equal((html.match(/