feat: restore gateway HMR and add WRN formatting

This commit is contained in:
2026-07-13 14:54:03 +05:30
parent 3b46c69601
commit cff420a29e
71 changed files with 727 additions and 119 deletions
+9
View File
@@ -4,6 +4,7 @@ import {
forwardAuthFailure,
forwardAuthHeaders,
gatewayProxyHeaders,
gatewayRestartDelay,
} from "../src/gateway.ts";
test("gateway uses platform-safe hostname defaults", () => {
@@ -56,3 +57,11 @@ test("forward auth describes the original gateway request", () => {
expect(headers.get("cookie")).toBe("session=abc");
expect(headers.get("authorization")).toBe("Bearer token");
});
test("gateway respawns development apps after an HMR restart exit", () => {
expect(gatewayRestartDelay("development", 97, null)).toBe(0);
expect(gatewayRestartDelay("development", 1, null)).toBe(1200);
expect(gatewayRestartDelay("development", 0, null)).toBeNull();
expect(gatewayRestartDelay("development", 97, "SIGTERM")).toBeNull();
expect(gatewayRestartDelay("production", 97, null)).toBeNull();
});