import assert from "node:assert/strict";
import { test } from "node:test";
import { fileURLToPath } from "node:url";
import { build } from "esbuild";
import { chromium } from "playwright";
// A child iframe inside an App (a Shed tray, say) takes focus from the App's
// own document. The window blur that causes must not tell the host the App
// lost focus, or its window would drop its active state and flicker.
const entry = fileURLToPath(
new globalThis.URL("../src/internal/browser-bridge.ts", import.meta.url),
);
const bundle = await build({
entryPoints: [entry],
bundle: true,
format: "iife",
globalName: "bridge",
write: false,
platform: "browser",
});
const script = bundle.outputFiles[0].text;
const page = `