From c03c643a7c3d177235150a34a14f8d8f1d49766c Mon Sep 17 00:00:00 2001 From: saberzero1 Date: Fri, 27 Nov 2026 16:32:34 +0100 Subject: [PATCH] test: compare emitted paths with / and give the parser POSIX paths, so the new tests pass on Windows --- .../plugins/emitters/componentResources.emit.test.ts | 2 +- quartz/plugins/pageTypes/dispatcher.emit.test.ts | 2 +- quartz/processors/parse.test.ts | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/quartz/plugins/emitters/componentResources.emit.test.ts b/quartz/plugins/emitters/componentResources.emit.test.ts index 7ecc852ab..1f8c014a8 100644 --- a/quartz/plugins/emitters/componentResources.emit.test.ts +++ b/quartz/plugins/emitters/componentResources.emit.test.ts @@ -106,7 +106,7 @@ async function emit( } as unknown as BuildCtx const written: string[] = [] for await (const fp of ComponentResources().emit(ctx, [], resources) as AsyncIterable) { - written.push(path.relative(output, fp)) + written.push(path.relative(output, fp).split(path.sep).join("/")) } const read = (name: string) => fs.readFileSync(path.join(output, name), "utf8") return { ctx, written, read } diff --git a/quartz/plugins/pageTypes/dispatcher.emit.test.ts b/quartz/plugins/pageTypes/dispatcher.emit.test.ts index 0357036a1..a340decdb 100644 --- a/quartz/plugins/pageTypes/dispatcher.emit.test.ts +++ b/quartz/plugins/pageTypes/dispatcher.emit.test.ts @@ -104,7 +104,7 @@ const linkOf = ([tree]: ReturnType) => (tree as Root).children[0] a async function collect(gen: AsyncGenerator | AsyncIterable, output: string) { const out: string[] = [] - for await (const fp of gen) out.push(path.relative(output, fp)) + for await (const fp of gen) out.push(path.relative(output, fp).split(path.sep).join("/")) return out.sort() } diff --git a/quartz/processors/parse.test.ts b/quartz/processors/parse.test.ts index 56e70b599..856692ee5 100644 --- a/quartz/processors/parse.test.ts +++ b/quartz/processors/parse.test.ts @@ -68,11 +68,13 @@ describe("parseMarkdown (one thread)", () => { }) test("runs text, Markdown and HTML transforms in plugin order and sets the file's paths", async () => { - const dir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "quartz-parse-")) + // Quartz passes POSIX-style paths (its glob yields them on Windows too) + const posix = (p: string) => p.split(path.sep).join("/") + const dir = posix(await fs.promises.mkdtemp(path.join(os.tmpdir(), "quartz-parse-"))) try { - await fs.promises.mkdir(path.join(dir, "Sub Folder")) - const a = path.join(dir, "Sub Folder", "My Note.md") - const b = path.join(dir, "other.md") + await fs.promises.mkdir(`${dir}/Sub Folder`) + const a = `${dir}/Sub Folder/My Note.md` + const b = `${dir}/other.md` await fs.promises.writeFile(a, "\n\n # Title \n\n") await fs.promises.writeFile(b, "text") const log: string[] = []