diff --git a/packages/glob/__tests__/windows-path-matching.test.ts b/packages/glob/__tests__/windows-path-matching.test.ts index ce0c7ce8..99b74d24 100644 --- a/packages/glob/__tests__/windows-path-matching.test.ts +++ b/packages/glob/__tests__/windows-path-matching.test.ts @@ -17,10 +17,10 @@ describe('Windows path matching', () => { // Test basic pattern matching with Windows paths const pattern = new Pattern('C:\\Users\\test\\*') - + // The itemPath would come from fs.readdir with backslashes on Windows const itemPath = 'C:\\Users\\test\\file.txt' - + // This should match because the pattern and path both refer to the same file expect(pattern.match(itemPath)).toBe(MatchKind.All) }) @@ -32,7 +32,7 @@ describe('Windows path matching', () => { // Test partial matching with Windows paths const pattern = new Pattern('C:\\Users\\test\\**') - + // Should partially match parent directory expect(pattern.partialMatch('C:\\Users')).toBe(true) expect(pattern.partialMatch('C:\\Users\\test')).toBe(true) @@ -44,7 +44,7 @@ describe('Windows path matching', () => { } const pattern = new Pattern('C:\\foo\\**') - + // Should match the directory itself and descendants expect(pattern.match('C:\\foo')).toBe(MatchKind.All) expect(pattern.match('C:\\foo\\bar')).toBe(MatchKind.All) @@ -58,7 +58,7 @@ describe('Windows path matching', () => { // Pattern might be specified with forward slashes by user const pattern = new Pattern('C:/Users/*/file.txt') - + // But the actual path from filesystem will have backslashes expect(pattern.match('C:\\Users\\test\\file.txt')).toBe(MatchKind.All) }) @@ -70,10 +70,14 @@ describe('Windows path matching', () => { const currentDrive = process.cwd().substring(0, 2) const pattern = new Pattern(`${currentDrive}\\**\\*.txt`) - + // Should match .txt files at any depth expect(pattern.match(`${currentDrive}\\file.txt`)).toBe(MatchKind.All) - expect(pattern.match(`${currentDrive}\\foo\\bar\\test.txt`)).toBe(MatchKind.All) - expect(pattern.match(`${currentDrive}\\foo\\bar\\test.js`)).toBe(MatchKind.None) + expect(pattern.match(`${currentDrive}\\foo\\bar\\test.txt`)).toBe( + MatchKind.All + ) + expect(pattern.match(`${currentDrive}\\foo\\bar\\test.js`)).toBe( + MatchKind.None + ) }) })