feat: support custom server entry (#3216)

This commit is contained in:
Marvin Hagemeister
2025-08-12 12:50:10 +02:00
committed by GitHub
parent f27f10fbcb
commit fe4a59a88c
5 changed files with 41 additions and 3 deletions
+27
View File
@@ -503,6 +503,33 @@ export const app = new App()
sanitizeResources: false,
});
Deno.test({
name: "Builder - custom server entry",
fn: async () => {
const root = path.join(import.meta.dirname!, "..", "..");
await using _tmp = await withTmpDir({ dir: root, prefix: "tmp_builder_" });
const tmp = _tmp.dir;
await writeFiles(tmp, {
"other.ts": `import { App, staticFiles } from "fresh";
export const app = new App()
.get("/", () => new Response("ok"));`,
});
await new Builder({ root: tmp, serverEntry: "other.ts" }).build();
await withChildProcessServer(
{ cwd: tmp, args: ["serve", "-A", "--port=0", "_fresh/server.js"] },
async (address) => {
const res = await fetch(`${address}`);
expect(await res.text()).toEqual("ok");
},
);
},
sanitizeOps: false,
sanitizeResources: false,
});
Deno.test({
name: "Builder - dev server error_overlay ignores _app and _layout",
fn: async () => {