mirror of
https://github.com/vitest-dev/vitest.git
synced 2026-01-25 16:48:18 +00:00
19 lines
610 B
TypeScript
19 lines
610 B
TypeScript
import { expect, test } from 'vitest'
|
|
|
|
// @ts-expect-error network imports
|
|
import slash from 'http://localhost:9602/slash@3.0.0.js'
|
|
|
|
// test without local server
|
|
// import slash from 'https://esm.sh/slash@3.0.0'
|
|
|
|
test('network imports', () => {
|
|
expect(slash('foo\\bar')).toBe('foo/bar')
|
|
})
|
|
|
|
test('doesn\'t work for http outside localhost', async () => {
|
|
// @ts-expect-error network imports
|
|
await expect(() => import('http://100.0.0.0/')).rejects.toThrowError(
|
|
'import of \'http://100.0.0.0/\' by undefined is not supported: http can only be used to load local resources (use https instead).',
|
|
)
|
|
})
|