Files
jp-editor/test/m0.test.mjs
T
2026-09-22 16:33:35 +08:00

21 lines
739 B
JavaScript

import { execFileSync } from "node:child_process";
import { readFile } from "node:fs/promises";
import test from "node:test";
import assert from "node:assert/strict";
const run = (command, args) => execFileSync(command, args, { encoding: "utf8", stdio: "pipe" });
test("M0 baseline check passes", () => {
const output = run(process.execPath, ["scripts/m0-check.mjs"]);
const result = JSON.parse(output);
assert.equal(result.ok, true);
assert.equal(result.samplePairs, 33);
});
test("M0 build emits a browser entry point", async () => {
const source = await readFile("dist/main.js", "utf8");
const page = await readFile("dist/index.html", "utf8");
assert.match(source, /mountEditor/);
assert.match(page, /main\.js/);
});