Files
dev/third_party/pi/packages/chord/test/loader.test.ts
alexion 6081e3e325 chore(vendor): import pi 1.3.0
Imported as a linear vendor commit so forge rebases do not replay the upstream root tree.

git-subtree-dir: third_party/pi

git-subtree-split: 71023aec1546d6d677a65669c5665c0927ce0dd0
2026-10-15 17:58:48 -04:00

22 lines
857 B
TypeScript

import assert from "node:assert/strict";
import { spawnSync } from "node:child_process";
import { fileURLToPath } from "node:url";
import { describe, it } from "vitest";
import { createHost } from "../src/index.ts";
describe("node loader", () => {
it("loads facet modules and reloads them with fresh copies of their relative imports", () => {
const child = spawnSync(process.execPath, [fileURLToPath(new URL("./fixtures/loader.ts", import.meta.url))], {
encoding: "utf8",
timeout: 30_000,
});
assert.equal(child.error, undefined, child.stderr);
assert.equal(child.status, 0, `${child.stdout}\n${child.stderr}`);
});
it("needs a configured loader for modules", async () => {
const host = createHost({ self: { kind: "host" }, onError: () => {} });
await assert.rejects(host.load(["./facet.ts"]), /createHost\(\{ loader \}\)/);
});
});