Files
clean-architecture-frontend…/tests/component/boot-module-failure.test.tsx
DongHyeonkaandClaude Opus 5.5 9c8a5f417a fix(bootstrap): show the boot error shell when the app graph fails to evaluate (09-03)
A module that threw while evaluating stopped main.tsx before boot() ran, so the
static loading shell stayed up. The entry now imports the app (boot.tsx)
dynamically and renders the shell on rejection; the shell reads boot messages
without the feature catalog. The preload helper gets its own chunk so lazy
chunks do not import the per-build entry, and the bundle budget counts the
entry's dynamic imports as initial JS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:54:40 +09:00

26 lines
1.1 KiB
TypeScript

// @vitest-environment jsdom
import { screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
// 09-03. A throw while the feature graph evaluates (a duplicate message key,
// a route or operation conflict) used to stop main.tsx before boot() ran, so
// the static "loading" shell stayed up forever.
vi.mock("../../src/.generated/product-feature-index.ts", () => {
throw new TypeError("Duplicate ko-KR message key: probe.title");
});
describe("boot entry (09-03)", () => {
it("shows the boot error shell when the app graph fails to evaluate", async () => {
document.body.innerHTML =
'<div id="root"><div role="status" data-boot-shell="">불러오는 중</div></div>';
vi.spyOn(console, "error").mockImplementation(() => {});
await import("../../src/bootstrap/main.tsx");
const shell = await screen.findByRole("alert", undefined, { timeout: 5_000 });
expect(shell).toHaveTextContent("애플리케이션을 시작할 수 없습니다.");
expect(document.querySelector("[data-boot-shell]")).toBeNull();
});
});