-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Make sure
files
globs are normalized. (#5665)
- Loading branch information
Showing
2 changed files
with
37 additions
and
5 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
packages/cspell-lib/src/lib/Settings/Controller/configLoader/normalizeRawSettings.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { fileURLToPath, pathToFileURL } from 'node:url'; | ||
|
||
import { describe, expect, test } from 'vitest'; | ||
|
||
import { normalizeSettingsGlobs } from './normalizeRawSettings.js'; | ||
|
||
const pathToSettings = '/path/to/settings.json'; | ||
const defaultSettingsUrl = pathToFileURL(pathToSettings); | ||
const defaultSettingsPath = fileURLToPath(defaultSettingsUrl); | ||
|
||
describe('normalize settings', () => { | ||
test.each` | ||
settings | settingsUrl | expected | ||
${{}} | ${defaultSettingsUrl} | ${{}} | ||
${{ files: [], ignorePaths: [], id: 'id' }} | ${defaultSettingsUrl} | ${{ files: [], ignorePaths: [] }} | ||
${{ files: [], ignorePaths: undefined }} | ${defaultSettingsUrl} | ${{ files: [] }} | ||
${{ files: ['*.md'] }} | ${defaultSettingsUrl} | ${{ files: [{ glob: '*.md', source: defaultSettingsPath }] }} | ||
${{ files: ['*.md'] }} | ${'vscode-vfs:///path/to/settings.json'} | ${{ files: [{ glob: '*.md', source: 'vscode-vfs:///path/to/settings.json' }] }} | ||
${{ files: ['**/*.md'] }} | ${defaultSettingsUrl} | ${{ files: [{ glob: '**/*.md', source: defaultSettingsPath }] }} | ||
${{ ignorePaths: ['**/*.md'] }} | ${defaultSettingsUrl} | ${{ ignorePaths: [{ glob: '**/*.md', source: defaultSettingsPath }] }} | ||
`('normalizeSettingsGlobs $settings $settingsUrl', ({ settings, settingsUrl, expected }) => { | ||
expect(normalizeSettingsGlobs(settings, new URL(settingsUrl))).toEqual(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters