fix: only load error overlay in development (#2460)
This commit is contained in:
@@ -55,3 +55,23 @@ Deno.test("error overlay - should not be visible for HttpError <500", async () =
|
||||
expect(content).toContain("fresh-error-overlay");
|
||||
expect(res.status).toEqual(500);
|
||||
});
|
||||
|
||||
Deno.test("error overlay - should not be visible in prod", async () => {
|
||||
const app = new App();
|
||||
app.use(devErrorOverlay());
|
||||
app.config.mode = "production";
|
||||
|
||||
app.get("/", () => {
|
||||
throw new HttpError(500);
|
||||
});
|
||||
|
||||
const server = new FakeServer(await app.handler());
|
||||
const res = await server.get("/", {
|
||||
headers: {
|
||||
accept: "text/html",
|
||||
},
|
||||
});
|
||||
const content = await res.text();
|
||||
expect(content).not.toContain("fresh-error-overlay");
|
||||
expect(res.status).toEqual(500);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user