scroll-restoration, production-csp, old-tab-chunk-recovery, boot-module-failure는 템플릿처럼 page.goto 뒤 첫 expect(5초) 안에 첫 화면이 그려지기를 기다린다. desktop 호스트의 WebKit은 화면 하나를 여는 데 혼자 돌 때도 3.8~4.6초가 걸린다(Case 화면, Chromium 0.93초). 그래서 다른 worker와 함께 돌면 5초를 넘겨 「불러오는 중」에서 떨어진다. 전체 test:e2e와 3회 반복에서 webkit만 이렇게 떨어졌다. 이 제품의 다른 브라우저 시험처럼 앱이 그려진 것(.site-frame, 부팅 실패면 alert)을 먼저 기다린다. scroll-restoration은 gotoTechLog로 연다. 시험하는 것(스크롤 위치, CSP, 다시 불러오기 횟수, 실패 화면 내용)은 그대로다. 부팅 실패 청크 수정 전후 WebKit 시간이 같아서(JS 14개일 때 3.8~4.6초, 36개일 때 3.8~4.1초) 청크 수가 원인은 아니다. 검증: 네 시험과 app-shell을 chromium·firefox·webkit에서 --repeat-each=3으로 81건 모두 통과.
65 lines
2.3 KiB
TypeScript
65 lines
2.3 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");
|
|
// The boot error shell replaces the loading shell once the boot has
|
|
// failed; see scroll-restoration.spec.ts for why this is not a 5 s window.
|
|
await shell.waitFor();
|
|
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();
|
|
}
|
|
});
|