silverwolf-x/project / packages /next /src /next-devtools /shared /webpack-module-path.test.ts
silverwolf-x's picture
download
raw
1.4 kB
import {
formatStackFrameFile,
isWebpackInternalResource,
} from './webpack-module-path'
describe('webpack-module-path', () => {
describe('isWebpackInternalResource', () => {
it('should return true for webpack-internal paths', () => {
expect(
isWebpackInternalResource('webpack-internal:///./src/hello.tsx')
).toBe(true)
expect(isWebpackInternalResource('webpack://_N_E/./src/hello.tsx')).toBe(
true
)
expect(isWebpackInternalResource('webpack://./src/hello.tsx')).toBe(true)
expect(isWebpackInternalResource('webpack:///./src/hello.tsx')).toBe(true)
})
it('should return false for non-webpack-internal paths', () => {
expect(isWebpackInternalResource('<anonymous>')).toBe(false)
expect(isWebpackInternalResource('file:///src/hello.tsx')).toBe(false)
})
})
describe('formatFrameSourceFile', () => {
it('should return the original file path', () => {
expect(formatStackFrameFile('webpack-internal:///./src/hello.tsx')).toBe(
'./src/hello.tsx'
)
expect(formatStackFrameFile('webpack://_N_E/./src/hello.tsx')).toBe(
'./src/hello.tsx'
)
expect(formatStackFrameFile('webpack://./src/hello.tsx')).toBe(
'./src/hello.tsx'
)
expect(formatStackFrameFile('webpack:///./src/hello.tsx')).toBe(
'./src/hello.tsx'
)
})
})
})

Xet Storage Details

Size:
1.4 kB
·
Xet hash:
cbbf057abc64c6b7ea9d30d58efde63b8340cf3d2a8dd7bf34ac4ab27aa2e303

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.