mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
src/next is src (the main export), src/next-node is src/node with short subpaths (/http, /workers, /plugins, /plugins/runtime, /app, /surfaces, /web, /react, /tui, /tui/launcher); the foundations get /json and /watch; Chord v1 moves to src/old (/old, /old/node) until p2 runs on v2; tests and docs move likewise (test/, docs/, test/old, docs/old). Durable and env import the foundations from their subpaths.
21 lines
864 B
TypeScript
21 lines
864 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/old/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 \}\)/);
|
|
});
|
|
});
|