// The prebuilt check: the release bundle, built in a child process (inside // `bun test` Bun.build inherits the test runtime's resolutions — see // scripts/sizes.ts), written into .size-fixtures (the preload creates it; // Bun's resolver cannot see a directory created after startup), then imported // with no compiler and no pebble on the consumer's side. It must self-register // and enhance a textarea. L3's headless-Chromium smoke carries // the real-engine weight; this catches a bundle that only works through the // repo's own toolchain. import { expect, test } from "bun:test"; const ROOT = `${import.meta.dir}/..`; const BUNDLE = `${ROOT}/.size-fixtures/tablet.dist.js`; const built = Bun.spawnSync( [ "bun", "-e", `import { buildRelease } from "./scripts/release.ts"; import { writeEntryShim, discoverPackages } from "./scripts/packages.ts"; const pkg = (await discoverPackages()).find(p => p.name === "tablet"); if (!pkg) throw new Error("packages/tablet not found"); await Bun.write(".size-fixtures/tablet.dist.js", await buildRelease(await writeEntryShim(pkg)));`, ], { cwd: ROOT }, ); if (built.exitCode !== 0) throw new Error(`fixture build failed:\n${built.stderr.toString()}`); await import(BUNDLE); test("the release bundle self-registers and enhances, no compiler involved", () => { const el = document.createElement("pebble-tablet"); const field = document.createElement("textarea"); field.name = "body"; field.value = "vendored"; el.appendChild(field); document.body.appendChild(el); // The engine-era surface: the textarea itself, visible and enhanced. expect(el.getAttribute("data-enhanced")).toBe(""); expect(field.hidden).toBe(false); expect(field.getAttribute("part")).toBe("editor field"); expect((el as unknown as { editor?: { doc: string } }).editor?.doc).toBe("vendored"); document.body.textContent = ""; });