fix: client script source map returning 404 (#2071)

This commit is contained in:
Marvin Hagemeister
2023-11-27 16:10:36 +01:00
committed by GitHub
parent 74672b1095
commit 1294d455bc
2 changed files with 28 additions and 4 deletions
+19 -1
View File
@@ -1,4 +1,4 @@
import { assertEquals, assertStringIncludes } from "./deps.ts";
import { assert, assertEquals, assertStringIncludes } from "./deps.ts";
import { Status } from "../server.ts";
import {
assertNotSelector,
@@ -146,3 +146,21 @@ Deno.test("show codeframe in dev mode even with custom 500", async () => {
},
);
});
Deno.test("serve client script source map", async () => {
await withFakeServe(
"./tests/fixture/dev.ts",
async (server) => {
const res = await server.get(`/_frsh/fresh_dev_client.js`);
await res.text(); // Consume body
assertEquals(res.status, 200);
assertEquals(res.headers.get("Content-Type"), "application/javascript");
const res2 = await server.get(`/_frsh/fresh_dev_client.js.map`);
const json = await res2.json();
assertEquals(res2.status, 200);
assertEquals(res2.headers.get("Content-Type"), "application/json");
assert(typeof json.mappings, "string");
},
);
});