From 0289e0baddc4c3b63e303f62d11b6397fe04f0ea Mon Sep 17 00:00:00 2001 From: donghyeon-ka Date: Mon, 28 Sep 2026 01:19:36 +0900 Subject: [PATCH] test(e2e): change a route chunk on purpose in service worker build B "serves A's removed chunk from the previous cache" needs a route chunk of A that B no longer ships. Route chunks used to differ only because they embedded the build ID; since 09-02 (a8111f7) they do not, so A and B emitted the same route chunks and the test failed in setup. Found by running the whole e2e suite after integration and bisecting from 4626b73. Build B now appends an export to the not-found page, which a dynamically imported module keeps. Co-Authored-By: Claude Opus 5.5 --- tests/e2e/service-worker-update.spec.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/e2e/service-worker-update.spec.ts b/tests/e2e/service-worker-update.spec.ts index 6906d97c..3d0f2a75 100644 --- a/tests/e2e/service-worker-update.spec.ts +++ b/tests/e2e/service-worker-update.spec.ts @@ -1,4 +1,4 @@ -import { readdir, readFile } from "node:fs/promises"; +import { appendFile, readdir, readFile } from "node:fs/promises"; import path from "node:path"; import { expect, test, type Page } from "../support/browser/strict-browser-test.ts"; @@ -35,9 +35,24 @@ type Probe = typeof globalThis & { let builds: ServiceWorkerBuilds | undefined; +// B changes one route chunk on purpose. Route chunks used to differ only +// because they embedded the build ID; since 09-02 they do not, so two builds +// of the same source emit the same route chunks. A dynamically imported +// module keeps all its exports, so the extra export survives the bundler. +const CHANGED_ROUTE_SOURCE = + "src/presentation/pages/not-found-page.tsx"; + test.beforeAll(async () => { test.setTimeout(180_000); - builds = await prepareServiceWorkerBuilds(); + builds = await prepareServiceWorkerBuilds({ + beforeBuild: async (name, root) => { + if (name !== "b") return; + await appendFile( + path.join(root, CHANGED_ROUTE_SOURCE), + '\nexport const serviceWorkerE2eBuild = "b";\n', + ); + }, + }); }); test.afterAll(async () => {