Files
clean-architecture-frontend…/tests/browser-capabilities/chunk-load-error.spec.ts
T
DongHyeonkaandClaude Opus 5.5 d7fc464426 test(browser-capabilities): pin chunk-failure wording on all three engines (R3-7)
Run the app's isChunkLoadFailure (served by the dev server) against the real
error each engine raises for a missing dynamic-import chunk. Passes on
Chromium, Firefox and WebKit. Record the WebKit run (e2e 39, capabilities 17).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 15:48:57 +09:00

30 lines
1.2 KiB
TypeScript

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);
});