Files
clean-architecture-frontend…/tests/e2e/boot-module-failure.spec.ts
DongHyeonka e3c8db48ae chore(features): 참조 기능과 예제 화면을 지우고 레지스트리를 다시 승인한다
소유자 결정(2026-11-07, design-docs repo-structure/README.md 3.4절)으로
템플릿 샘플을 지운다. 샘플이 맡던 시험 대상은 앞 커밋들이 옮겼다.

참조 기능과 예제 화면, 두 context, 그 시험, e2e 3개, 수동 접근성 기록
7개, 런타임 프로필 키, test:reference-feature(명령, 산출물, 게이트
참조), 커버리지 정책 행을 지웠다. removable-template-features 목록은
비우고 장치는 남겼다: test:sample-removal은 인자가 없으면 목록을
하나씩 지우고, 비면 SKIP을 출력하고 보고서에 건너뛴 사례를 남긴다.
기능 스위치 시험과 홈 시작 링크 스위치 시험은 시험 전용 fixture 기능으로
옮겼다. browser soak은 생성 기능을 넣은 빌드에서 돈다. 문서의 샘플
경로를 고쳤다. 날짜가 붙은 설계·리뷰 기록의 본문은 그대로 두었다.
레지스트리 기준선(update:registry-baseline, OWNER DongHyeonka), CI 계약
기준선과 workflow, 초기 JS 기록(194,354B, 17파일, 첫 기능 6,327B, 기능
539B, context 4B)을 다시 받았다.

위험: 레지스트리 행 삭제는 breaking이다. 샘플을 고쳐 쓰는 다운스트림은
수정/삭제 충돌을 만난다. 성능 lab의 기능 라우트 측정은 템플릿에
공개 기능 라우트가 없어 measured:false다. TEMPLATE_FIXTURE 출처는
플랫폼 코드에 남았다.

검증(desktop): check:types, lint, check:architecture, check:registries,
check:ci, verify:documentation, test:unit, test:component,
test:contract, test:integration, test:recipes, test:coverage(Risk
coverage PASS 378/378, 문턱 68개), test:e2e 183, test:a11y, test:visual,
test:storybook, test:browser-capabilities, test:feature-scaffold PASS(76
checks), test:sample-removal SKIP, build, check:bundle.
2026-11-08 14:07:58 +09:00

90 lines
3.5 KiB
TypeScript

import { readFile } from "node:fs/promises";
import path from "node:path";
import { addGeneratedFeature } from "../../scripts/lib/generated-feature.ts";
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. The template installs no
* feature, so the copy gets the one `create:feature` writes first: with none
* there is no key to meet twice.
*/
let builds: FixtureBuilds<"broken"> | undefined;
test.beforeAll(async () => {
test.setTimeout(300_000);
builds = await prepareFixtureBuilds("boot-module-failure", [
{
name: "broken",
edit: async (root) => {
await addGeneratedFeature(root);
await 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);
});
// 1103/11-09. Vite preloads the boot chunk with everything it imports. A
// module of that graph throws, so the graph stops evaluating and its
// remaining chunks stay preloaded and unrun: the provoked failure's own
// effect. Only the boot graph's chunks are allowed.
test.use({
allowedBrowserFailure: async ({ browserName: _engine }, provide) => {
if (!builds) throw new Error("Fixture build was not prepared.");
const manifest = JSON.parse(
await readFile(path.join(builds.dist.broken, ".vite/manifest.json"), "utf8"),
) as Record<string, { file: string; imports?: string[] }>;
const files = new Set<string>();
const pending = ["src/bootstrap/boot.tsx"];
for (let key = pending.pop(); key !== undefined; key = pending.pop()) {
const entry = manifest[key];
if (!entry || files.has(entry.file)) continue;
files.add(entry.file);
pending.push(...(entry.imports ?? []));
}
if (files.size === 0) throw new Error("The broken build has no boot chunk.");
const alternatives = [...files].map((file) => file.replaceAll(".", String.raw`\.`));
await provide(new RegExp(String.raw`^preloadunused:/(?:${alternatives.join("|")})$`, "u"));
},
});
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();
}
});