From 5fee3494f73f391eba20b42edf7069a5fe94c74f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kaan=20=C3=87elebi?= Date: Sun, 13 Sep 2026 18:21:55 +0300 Subject: [PATCH] test: normalize config snapshot paths and run tests on Windows Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01XvSbVkca8tLnsnVVNKUQHQ --- .github/workflows/ci.yaml | 7 +++++-- tests/config.test.ts | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ecc98faa..b0cd1969 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,8 +24,11 @@ jobs: - name: Check for errors in code/formatting run: pnpm lint test: - name: Test - runs-on: ubuntu-latest + name: Test (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest] steps: - name: Checkout the repository uses: actions/checkout@v4 diff --git a/tests/config.test.ts b/tests/config.test.ts index 3240d1f0..1a5feed0 100644 --- a/tests/config.test.ts +++ b/tests/config.test.ts @@ -1,6 +1,7 @@ // tests/config.test.ts // Tests for the configuration loader. +import { sep } from 'node:path'; import { afterEach, describe, test, expect, vi } from 'vitest'; import { loadConfiguration } from '../source/utilities/config.js'; @@ -9,11 +10,21 @@ import { Options } from '../source/types.js'; // The path to the fixtures for this test file. const fixtures = 'tests/__fixtures__/config/'; -// A helper function to load the configuration for a certain fixture. -const loadConfig = ( +// A helper function to load the configuration for a certain fixture. The +// `public` path uses the platform's separator, so normalize it for snapshots. +const loadConfig = async ( name: 'valid' | 'invalid' | 'non-existent' | 'deprecated', args?: Partial = {}, -) => loadConfiguration(process.cwd(), `${fixtures}/${name}`, args); +) => { + const configuration = await loadConfiguration( + process.cwd(), + `${fixtures}/${name}`, + args, + ); + if (configuration.public) + configuration.public = configuration.public.split(sep).join('/'); + return configuration; +}; afterEach(() => { vi.restoreAllMocks();