fix: remove error frame HTML for non-dev mode (#2133)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
This commit is contained in:
co-authored by
Marvin Hagemeister
parent
c4e09d1cef
commit
96644f5e22
+23
-1
@@ -1,5 +1,10 @@
|
||||
import { STATUS_CODE } from "../server.ts";
|
||||
import { assertEquals, assertStringIncludes } from "./deps.ts";
|
||||
import {
|
||||
assertEquals,
|
||||
AssertionError,
|
||||
assertRejects,
|
||||
assertStringIncludes,
|
||||
} from "./deps.ts";
|
||||
import { getErrorOverlay, withFakeServe } from "./test_utils.ts";
|
||||
|
||||
Deno.test("error page rendered", async () => {
|
||||
@@ -15,3 +20,20 @@ Deno.test("error page rendered", async () => {
|
||||
assertStringIncludes(stack, `at render`);
|
||||
});
|
||||
});
|
||||
|
||||
Deno.test("error page rendered without error overlay", async () => {
|
||||
await withFakeServe("./tests/fixture_error/main.ts", async (server) => {
|
||||
const resp = await server.get("/");
|
||||
assertEquals(resp.status, STATUS_CODE.InternalServerError);
|
||||
assertEquals(resp.headers.get("content-type"), "text/html; charset=utf-8");
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(body, "<p>500 page</p>");
|
||||
|
||||
await assertRejects(
|
||||
() => getErrorOverlay(server, "/"),
|
||||
AssertionError,
|
||||
undefined,
|
||||
"Missing fresh error overlay",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user