Skip to content

Commit 37937e0

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 8560608 commit 37937e0

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

test/path.test.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,14 @@ 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:[\\/]/,
525-
)
526-
expect(pathLikeToString(new URL('file:///D:/data/file.txt'))).toMatch(
527-
/^D:[\\/]/,
528-
)
523+
expect(
524+
normalizePath(pathLikeToString(new URL('file:///C:/Windows'))),
525+
).toMatch(/^C:\//)
526+
expect(
527+
normalizePath(
528+
pathLikeToString(new URL('file:///D:/data/file.txt')),
529+
),
530+
).toMatch(/^D:\//)
529531
}
530532
})
531533

0 commit comments

Comments
 (0)