import assert from "node:assert/strict"; import crypto from "node:crypto"; import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../.."); const read = (relativePath) => fs.readFileSync(path.join(root, relativePath)); const sha256 = (value) => crypto.createHash("sha256").update(value).digest("hex"); const manifest = JSON.parse(read("tests/golden/M12-03N/manifest.json")); const packageJson = JSON.parse(read("web/package.json")); const expected = { "append-desktop": "node ../tools/web/check-library-append-fixture.mjs", "append-wasm": "node --test tests/unit/library-append-wasm.test.mjs", "append-chromium": "playwright test --config playwright.config.ts --workers=1 tests/e2e/library-append-main.spec.ts", "link-desktop": "node ../tools/web/check-library-link-fixture.mjs", "link-wasm": "node --test tests/unit/library-linked-mutation.test.mjs tests/unit/library-linked-reload.test.mjs tests/unit/library-linked-missing.test.mjs", "link-chromium": "playwright test --config playwright.config.ts --workers=1 tests/e2e/library-link-chromium.spec.ts", "override-desktop": "node ../tools/web/check-library-override-fixture.mjs", "override-wasm": "node --test tests/unit/library-override-writer.test.mjs tests/unit/library-override-freshness.test.mjs", "override-chromium": "playwright test --config playwright.config.ts --workers=1 tests/e2e/library-override-chromium.spec.ts", }; for (const [name, command] of Object.entries(expected)) assert.equal(packageJson.scripts[`test:library-${name}`], command, name); for (const artifact of Object.values(manifest.artifacts)) assert.equal(sha256(read(artifact.path)), artifact.sha256, artifact.path); assert.equal(manifest.task, "M12-03N"); assert.equal(manifest.nextTask, "M12-04A"); assert.equal(Object.keys(expected).length, 9); process.stdout.write("library-operation-commands-check-ok lanes=9 operations=3 desktop=3 wasm=3 chromium=3 next=M12-04A\n");