Skip to content

Commit cb17fd9

Browse files
committed
Use normalizePath for Windows file URL tests
Instead of accepting both backslashes and forward slashes with regex, properly normalize paths using normalizePath() helper to ensure consistent forward slash output.
1 parent 400d2e2 commit cb17fd9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/path.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,11 +520,11 @@ describe('path utilities', () => {
520520

521521
it('should handle Windows file URLs', () => {
522522
if (process.platform === 'win32') {
523-
expect(pathLikeToString(new URL('file:///C:/Windows'))).toMatch(
524-
/^C:[\\/]/,
523+
expect(normalizePath(pathLikeToString(new URL('file:///C:/Windows')))).toMatch(
524+
/^C:\//,
525525
)
526-
expect(pathLikeToString(new URL('file:///D:/data/file.txt'))).toMatch(
527-
/^D:[\\/]/,
526+
expect(normalizePath(pathLikeToString(new URL('file:///D:/data/file.txt')))).toMatch(
527+
/^D:\//,
528528
)
529529
}
530530
})

0 commit comments

Comments
 (0)