// Step 1 acceptance proofs (DESIGN.md §Build order, step 1): // 1. page boots the runtime in a COI'd browser, CJS main requires a local module, // prints "Hello, Ada!", exits 0 // 2. missing module → MODULE_NOT_FOUND path, exit 1 // 3. boot() without cross-origin isolation → named IsolationError, no degraded mode import { test, expect } from "@playwright/test"; test("boots and runs a CJS main that requires a local module", async ({ page }) => { await page.goto("/demo/index.html"); // The name comes from /app/name.txt (editable) — assert the shape, not the name. await expect(page.locator("#out")).toContainText(/Hello, .+!/, { timeout: 15_000 }); await expect(page.locator("#exit")).toHaveText("0", { timeout: 15_000 }); await expect(page.locator("#err")).toHaveText(""); }); test("node:fs readFileSync goes through the builtin registry and sync mailbox", async ({ page }) => { // The greeting content comes from /app/name.txt — proving require('node:fs') worked. await page.goto("/demo/index.html"); await expect(page.locator("#out")).toContainText(/Hello, .+!/, { timeout: 15_000 }); }); test("missing module reports MODULE_NOT_FOUND and exits 1", async ({ page }) => { await page.goto("/demo/missing.html"); await expect(page.locator("#err")).toContainText("Cannot find module", { timeout: 15_000 }); await expect(page.locator("#exit")).toHaveText("1", { timeout: 15_000 }); }); test("boot refuses without cross-origin isolation", async ({ page }) => { await page.goto("/demo/no-coi.html"); await expect(page.locator("#err")).toContainText("IsolationError", { timeout: 15_000 }); await expect(page.locator("#err")).toContainText("[ERR_NIB_NOT_ISOLATED]"); });