From 58c7ac0ade36c1f1a14b15b5bf01475864d580fd Mon Sep 17 00:00:00 2001 From: KitsuneTech1 <182616862+KitsuneTech1@users.noreply.github.com> Date: Wed, 2 Sep 2026 16:04:29 -0500 Subject: [PATCH] fix: resolve site asset paths without breaking on Windows The asset existence check built a path from new URL(root).pathname, which on Windows yields /C:/Users/... with a leading slash. Every checkout on Windows failed "all local page assets exist" even when the files were present. CI runs on Linux, so the suite looked green. Resolve the URL properly and convert with fileURLToPath instead. The check still fails for a genuinely missing asset, verified both ways. --- tests/site-contract.test.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/site-contract.test.mjs b/tests/site-contract.test.mjs index 2a6d095..8d7c780 100644 --- a/tests/site-contract.test.mjs +++ b/tests/site-contract.test.mjs @@ -1,7 +1,7 @@ import assert from "node:assert/strict"; import { existsSync, readFileSync } from "node:fs"; import { test } from "node:test"; -import { join } from "node:path"; +import { fileURLToPath } from "node:url"; const root = new URL("../site/", import.meta.url); const pages = [ @@ -221,7 +221,7 @@ test("all local page assets exist", () => { for (const match of html.matchAll(/(?:href|src)="(\/[^"]+)"/g)) { const target = match[1].split("#", 1)[0].split("?", 1)[0]; if (target === "/" || target.endsWith("/")) continue; - assert.equal(existsSync(join(new URL(root).pathname, target)), true, `${page} references missing ${target}`); + assert.equal(existsSync(fileURLToPath(new URL(`.${target}`, root))), true, `${page} references missing ${target}`); } } });