From cef12b0f3355ce57f5bb5e283d76609dbb21188d Mon Sep 17 00:00:00 2001 From: aryanutkarsh Date: Fri, 9 Oct 2026 19:39:34 +0530 Subject: [PATCH] Run the test suite on Windows in CI Windows runs on Node 22 only (cmd.exe leaves the test glob unexpanded and node --test expands it itself from Node 21). Export tests open pages with pathToFileURL, since file://${path} is not a valid URL for C:\ paths. --- .github/workflows/ci.yml | 5 +++++ test/export.test.mjs | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb3655f..2e1fbb0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,11 @@ jobs: matrix: os: [ubuntu-latest, macos-latest] node: [20, 22] + # Windows on 22 only: cmd.exe leaves test/*.test.mjs unexpanded, and + # node --test expands globs itself only from Node 21 + include: + - os: windows-latest + node: 22 runs-on: ${{ matrix.os }} timeout-minutes: 20 steps: diff --git a/test/export.test.mjs b/test/export.test.mjs index 5845cf4..7db3b3e 100644 --- a/test/export.test.mjs +++ b/test/export.test.mjs @@ -4,6 +4,7 @@ import assert from 'node:assert/strict'; import { mkdtempSync, writeFileSync, readFileSync } from 'node:fs'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; +import { pathToFileURL } from 'node:url'; import { renderSpec } from '../skills/seecode/scripts/lib/render.mjs'; import { exportDiagram, launchBrowser } from '../skills/seecode/scripts/lib/export/export.mjs'; @@ -47,7 +48,7 @@ test('the HTML exports PNG/SVG/GIF/MP4 by itself (in-page menu)', { skip, timeou const { browser } = await launch(); try { const p = await browser.newPage({ viewport: { width: 1200, height: 700 } }); - await p.goto(`file://${html}`); + await p.goto(pathToFileURL(html).href); for (const kind of ['png', 'svg', 'gif', 'mp4']) { const r = await p.evaluate(async (k) => { window.SeeCode.lastExport = null; @@ -82,7 +83,7 @@ test('export size adapts to the content', { skip, timeout: 60000 }, async () => const html = join(dir, `${name}.html`); writeFileSync(html, renderSpec(spec).html); const p = await browser.newPage({ viewport: { width: 1200, height: 700 } }); - await p.goto(`file://${html}`); + await p.goto(pathToFileURL(html).href); plans[name] = await p.evaluate(() => Object.fromEntries(['png', 'gif', 'mp4'].map((f) => [f, window.SeeCode.exportPlan(f)]))); await p.close(); }