-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { expect, test, vi } from 'vitest' | ||
|
||
test.each([ | ||
{ platform: 'win32', id: 'file:///C:/Users/user/workspace/file.js', path: 'C:/Users/user/workspace/file.js' }, | ||
{ platform: 'darwin', id: 'file:///Users/user/workspace/file.js', path: '/Users/user/workspace/file.js' }, | ||
{ platform: 'linux', id: 'file:///Users/user/workspace/file.js', path: '/Users/user/workspace/file.js' }, | ||
] as { platform: NodeJS.Platform; id: string; path: string }[])( | ||
'normalizeRequestId should be normarlize file protocol path correctly in $platform', | ||
async ({ | ||
platform, | ||
id, | ||
path, | ||
}) => { | ||
const mockPlatform = vi.spyOn(process, 'platform', 'get') | ||
|
||
mockPlatform.mockReturnValue(platform) | ||
|
||
const { normalizeRequestId } = await import('vite-node/utils') | ||
|
||
expect(normalizeRequestId(id)).toBe(path) | ||
Check failure on line 20 in test/vite-node/test/utils.test.ts GitHub Actions / test (ubuntu-latest, 18)test/utils.test.ts > normalizeRequestId should be normarlize file protocol path correctly in 'darwin'
Check failure on line 20 in test/vite-node/test/utils.test.ts GitHub Actions / test (ubuntu-latest, 18)test/utils.test.ts > normalizeRequestId should be normarlize file protocol path correctly in 'linux'
Check failure on line 20 in test/vite-node/test/utils.test.ts GitHub Actions / test (ubuntu-latest, 20.14)test/utils.test.ts > normalizeRequestId should be normarlize file protocol path correctly in 'darwin'
Check failure on line 20 in test/vite-node/test/utils.test.ts GitHub Actions / test (ubuntu-latest, 20.14)test/utils.test.ts > normalizeRequestId should be normarlize file protocol path correctly in 'linux'
Check failure on line 20 in test/vite-node/test/utils.test.ts GitHub Actions / test (macos-14, 20.14)test/utils.test.ts > normalizeRequestId should be normarlize file protocol path correctly in 'darwin'
Check failure on line 20 in test/vite-node/test/utils.test.ts GitHub Actions / test (macos-14, 20.14)test/utils.test.ts > normalizeRequestId should be normarlize file protocol path correctly in 'linux'
Check failure on line 20 in test/vite-node/test/utils.test.ts GitHub Actions / test (windows-latest, 20.14)test/utils.test.ts > normalizeRequestId should be normarlize file protocol path correctly in 'darwin'
Check failure on line 20 in test/vite-node/test/utils.test.ts GitHub Actions / test (windows-latest, 20.14)test/utils.test.ts > normalizeRequestId should be normarlize file protocol path correctly in 'linux'
|
||
|
||
mockPlatform.mockClear() | ||
}, | ||
) |