Files
tech-log-frontend/tests/e2e/boot-module-failure.spec.ts
T
DongHyeonka 70f3125c8e test(e2e): 부팅 실패 fixture가 TechLog 메시지 카탈로그를 두 번 합친다
boot-module-failure 시험은 빌드 사본의 installed-feature-messages.ts에서
`composeInstalledMessageCatalogs(\n  INSTALLED_PRODUCT_FEATURE_MODULES,\n)`를
찾아 두 번 합치게 고친다. 같은 메시지 키가 두 번 들어가 모듈 평가 중에
예외가 나야 한다. 이 제품은 동기화 때 그 줄을 TechLog 카탈로그를 같이
합치는 배열로 바꿨다. 그래서 문자열을 찾지 못하고 빌드 전에 떨어진다.

TechLog 카탈로그 줄을 두 번 넣는다. 키가 겹쳐 같은 TypeError가 난다.

한계: 이제 fixture는 의도대로 동작하지만 시험은 여전히 떨어진다. 제품
결함이다. 예외가 나는 모듈이 route-not-found 청크에 묶이고, 부팅 실패
화면(render-boot-failure 청크)이 그 청크에서 두 값을 import한다. 그래서
부팅 실패 화면도 그리지 못하고 「불러오는 중」이 계속된다. 27e342d(PR #6
전) 빌드도 같은 import를 가지고 있어 react-dom 청크 분리 때문은 아니다.
청크 구성을 고치는 일은 이 PR 밖이다.

검증: 빌드 사본에서 「Duplicate ko-KR message key: route.TECH_LOG_HOME.title」
TypeError가 route-not-found 청크에서 나는 것을 trace로 확인했다.
2026-11-12 15:03:16 +09:00

62 lines
2.1 KiB
TypeScript

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) =>
// Template sync (af3d8e6): this product composes TechLog's catalogs
// next to the installed modules', so the duplicate is TechLog's.
editOnce(
path.join(root, "src/features/installed-feature-messages.ts"),
" Object.freeze({ messages: TECH_LOG_MESSAGE_CATALOGS }),\n]",
" Object.freeze({ messages: TECH_LOG_MESSAGE_CATALOGS }),\n Object.freeze({ messages: TECH_LOG_MESSAGE_CATALOGS }),\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();
}
});