import { expect, test } from "@playwright/test"; // R3-7. The chunk-recovery classifier matches engine error wording. Run the // app's own classifier (served by the dev server) against the error each real // engine reports for a dynamic import whose chunk is gone after a deploy, so a // wording change in Chromium, Firefox or WebKit fails here. test("classifies the engine's missing dynamic-import chunk error as a chunk failure", async ({ page, }) => { await page.goto("/"); const result = await page.evaluate(async () => { // A browser URL served by the dev server, not a module tsc resolves. const classifierUrl = "/src/presentation/boundaries/chunk-recovery-boundary.tsx"; const { isChunkLoadFailure } = (await import(classifierUrl)) as { isChunkLoadFailure: (error: unknown) => boolean; }; try { await import(`/assets/removed-after-deploy-${Date.now()}.js`); return { reported: "no error", classified: false }; } catch (error) { return { reported: error instanceof Error ? `${error.name}: ${error.message}` : String(error), classified: isChunkLoadFailure(error), }; } }); expect(result.classified, result.reported).toBe(true); });