fix: ensure file paths in snapshot.json uses / (#2704)
Avoids `\\\\` paths ending up in `snapshot.json` when using `deno task build` on Windows. Backslashes do not which pathnames in URLs, so these assets are not returned. Closes #2703
This commit is contained in:
@@ -44,6 +44,33 @@ Deno.test({
|
||||
sanitizeResources: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "Builder - handles Windows paths",
|
||||
fn: async () => {
|
||||
const builder = new Builder();
|
||||
const tmp = await Deno.makeTempDir();
|
||||
await Deno.mkdir(path.join(tmp, "images"));
|
||||
await Deno.writeTextFile(
|
||||
path.join(tmp, "images", "batman.svg"),
|
||||
"<svg></svg>",
|
||||
);
|
||||
const app = new App({
|
||||
staticDir: tmp,
|
||||
build: {
|
||||
outDir: path.join(tmp, "dist"),
|
||||
},
|
||||
});
|
||||
await builder.build(app);
|
||||
|
||||
const snapshotJson = await Deno.readTextFile(
|
||||
path.join(tmp, "dist", "snapshot.json"),
|
||||
);
|
||||
expect(snapshotJson).toContain("/images/batman.svg");
|
||||
},
|
||||
sanitizeOps: false,
|
||||
sanitizeResources: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "Builder - hashes CSS urls by default",
|
||||
fn: async () => {
|
||||
|
||||
Reference in New Issue
Block a user