feat: support Preact error boundaries (#1442)

This commit is contained in:
Marvin Hagemeister
2023-07-10 13:02:45 +02:00
committed by GitHub
parent 0131cffb29
commit 17811dd593
17 changed files with 110 additions and 66 deletions
+12 -1
View File
@@ -9,7 +9,7 @@ import {
import manifest from "./fixture/fresh.gen.ts";
import options from "./fixture/options.ts";
import { BUILD_ID } from "../src/server/build_id.ts";
import { startFreshServer } from "./test_utils.ts";
import { startFreshServer, withPageName } from "./test_utils.ts";
import { assertMatch } from "https://deno.land/std@0.193.0/testing/asserts.ts";
const ctx = await ServerContext.fromManifest(manifest, options);
@@ -868,3 +868,14 @@ Deno.test("rendering custom _500.tsx page for default handlers", {
await lines.cancel();
serverProcess.kill("SIGTERM");
});
Deno.test("renders error boundary", {
sanitizeOps: false,
sanitizeResources: false,
}, async () => {
await withPageName("./tests/fixture/main.ts", async (page, address) => {
await page.goto(`${address}/error_boundary`);
const text = await page.$eval("body", (el) => el.textContent);
assertEquals(text, "it works");
});
});