Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 14 additions & 3 deletions tests/config.test.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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<Options> = {},
) => 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();
Expand Down