test: 브라우저 게이트의 시험 쪽 실패를 고치고 질문 라벨 대비를 올린다 #7
@@ -1,6 +1,7 @@
|
||||
import { appendFile, readdir, readFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
import { collectStaticAssets } from "../../scripts/generate-service-worker-assets.ts";
|
||||
import { expect, test, type Page } from "../support/browser/strict-browser-test.ts";
|
||||
import {
|
||||
prepareServiceWorkerBuilds,
|
||||
@@ -39,8 +40,10 @@ let builds: ServiceWorkerBuilds | undefined;
|
||||
// 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.
|
||||
// Template sync (af3d8e6): upstream's not-found page is TechLog's Public one,
|
||||
// lazy-loaded like upstream's by `tech-log-route-runtime.tsx`.
|
||||
const CHANGED_ROUTE_SOURCE =
|
||||
"src/presentation/pages/not-found-page.tsx";
|
||||
"src/features/tech-log/presentation/public/pages/public-not-found-page.tsx";
|
||||
|
||||
test.beforeAll(async () => {
|
||||
test.setTimeout(180_000);
|
||||
@@ -89,6 +92,16 @@ async function hashedAssets(dist: string): Promise<string[]> {
|
||||
.sort();
|
||||
}
|
||||
|
||||
// Template sync (af3d8e6). Upstream compares the cache with every file under
|
||||
// assets/, which is its whole static asset set. This product's set differs
|
||||
// from that folder both ways: IBM Plex Mono's `.woff` fallbacks there are not
|
||||
// cacheable (SW-RR-03), and `media/` files outside it are. So the expected set
|
||||
// is the one the build declares, from the generator's own scan.
|
||||
async function staticAssetSet(dist: string): Promise<string[]> {
|
||||
const manifest = await collectStaticAssets(dist, "expected", "expected");
|
||||
return manifest.assets.map((asset) => asset.url).sort();
|
||||
}
|
||||
|
||||
const headerCases = [
|
||||
{
|
||||
name: "Content-Type: application/javascript",
|
||||
@@ -121,7 +134,7 @@ for (const { name, headers } of headerCases) {
|
||||
return { names, paths };
|
||||
});
|
||||
expect(cached.names).toHaveLength(1);
|
||||
expect(cached.paths.sort()).toEqual(await hashedAssets(dist.a));
|
||||
expect(cached.paths.sort()).toEqual(await staticAssetSet(dist.a));
|
||||
|
||||
// The server really sent the headers under test.
|
||||
const assets = server.served.filter((response) =>
|
||||
|
||||
Reference in New Issue
Block a user