import assert from "node:assert/strict"; import crypto from "node:crypto"; import fs from "node:fs"; import path from "node:path"; import { execFileSync } from "node:child_process"; import { fileURLToPath } from "node:url"; const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../.."); const abs = (file) => path.join(root, file); const read = (file) => fs.readFileSync(abs(file), "utf8"); const json = (file) => JSON.parse(read(file)); const sha = (file) => crypto.createHash("sha256").update(fs.readFileSync(abs(file))).digest("hex"); const writeJson = (file, value) => { fs.mkdirSync(path.dirname(abs(file)), { recursive: true }); fs.writeFileSync(abs(file), `${JSON.stringify(value, null, 2)}\n`); }; const parentPath = "tests/golden/WBV2-P26-005/manifest.json"; const parent = json(parentPath); assert.equal(parent.status, "done"); assert.equal(parent.nextTask, "WBV2-P26-006"); const assets = fs.readdirSync(abs("web/dist/assets")); const worker = assets.find((file) => /^web-engine\.worker-.*\.js$/u.test(file)); const wasm = assets.find((file) => /^web_engine-.*\.wasm$/u.test(file)); assert.ok(worker, "built WebEngine worker is missing"); assert.ok(wasm, "built WebEngine WASM is missing"); assert.match(read("web/dist/index.html"), /