test(e2e): open a build that throws at module evaluation (F-2)
09-03 moved the application graph behind a dynamic import, but only jsdom checked it. A real production build whose installed messages collide now opens in a browser and must show the boot error shell, not the loading shell. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8e5c51e813
commit
eb5264ce50
@@ -0,0 +1,59 @@
|
||||
import path from "node:path";
|
||||
|
||||
import { expect, test } from "../support/browser/strict-browser-test.ts";
|
||||
import {
|
||||
editOnce,
|
||||
prepareFixtureBuilds,
|
||||
removeFixtureBuilds,
|
||||
type FixtureBuilds,
|
||||
} from "./support/fixture-builds.ts";
|
||||
import { startBuildServer } from "./support/service-worker-builds.ts";
|
||||
|
||||
/**
|
||||
* 09-03 (F-2). A production build whose application graph throws while its
|
||||
* modules evaluate: the installed features are composed twice, so
|
||||
* `installed-feature-messages.ts` meets every message key a second time and
|
||||
* throws at module top level. The static "loading" shell used to stay up
|
||||
* forever; the boot error shell has to replace it.
|
||||
*/
|
||||
|
||||
let builds: FixtureBuilds<"broken"> | undefined;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
test.setTimeout(300_000);
|
||||
builds = await prepareFixtureBuilds("boot-module-failure", [
|
||||
{
|
||||
name: "broken",
|
||||
edit: (root) =>
|
||||
editOnce(
|
||||
path.join(root, "src/features/installed-feature-messages.ts"),
|
||||
"composeInstalledMessageCatalogs(\n INSTALLED_PRODUCT_FEATURE_MODULES,\n)",
|
||||
"composeInstalledMessageCatalogs([\n ...INSTALLED_PRODUCT_FEATURE_MODULES,\n ...INSTALLED_PRODUCT_FEATURE_MODULES,\n])",
|
||||
),
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await removeFixtureBuilds(builds);
|
||||
});
|
||||
|
||||
test("shows the boot error shell when a module throws while it evaluates", async ({
|
||||
page,
|
||||
}) => {
|
||||
if (!builds) throw new Error("Fixture build was not prepared.");
|
||||
const broken = builds.dist.broken;
|
||||
const server = await startBuildServer({ a: broken, b: broken });
|
||||
try {
|
||||
await page.goto(`${server.origin}/`);
|
||||
|
||||
const shell = page.getByRole("alert");
|
||||
await expect(shell).toContainText("애플리케이션을 시작할 수 없습니다.");
|
||||
await expect(shell).toContainText("BOOT_UNEXPECTED_FAILURE");
|
||||
await expect(shell).toContainText("TypeError");
|
||||
await expect(shell).toContainText("boot-module-failure-broken");
|
||||
await expect(page.locator("[data-boot-shell]")).toHaveCount(0);
|
||||
} finally {
|
||||
await server.close();
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user