// Widget document wrapper: byte stability and the host-bridge contract it emits.
import { createHash } from "node:crypto";
import { runInNewContext } from "node:vm";
import { describe, expect, it, vi } from "vitest";
import { buildWidgetDocument } from "./wrap.js";
describe("buildWidgetDocument", () => {
it("reports bounded runtime errors before widget code, deduplicating and limiting reports", () => {
const html = buildWidgetDocument("Failure", '');
const bridge = [...html.matchAll(/