Files
Will Binns-SmithandGitHub 8b7b6fea86 Turbopack tests: remove assertions that duplicate webpack results (#95688)
We forked test assertions in places in the early days of merging
Turbopack. Now that we more closely align, a bunch of these had the
exact same assertions. Fold them into one.
2026-07-10 12:11:26 -07:00

32 lines
908 B
TypeScript

import { nextTestSetup } from 'e2e-utils'
describe('import-meta', () => {
const { next, isTurbopack } = nextTestSetup({
files: __dirname,
})
describe('import.meta.url', () => {
it('should work on the server', async () => {
const $ = await next.render$('/')
const testData = $('#test-data').text()
const data = JSON.parse(testData)
expect(data.url).toStartWith('file:///')
expect(data.url).toEndWith('/pages/index.tsx')
})
it('should work in browser', async () => {
const browser = await next.browser('/')
const testData = await browser.elementByCss('#test-data').text()
const data = JSON.parse(testData)
if (isTurbopack) {
expect(data.url).toBe('file:///ROOT/pages/index.tsx')
} else {
expect(data.url).toStartWith('file:///')
expect(data.url).toEndWith('/pages/index.tsx')
}
})
})
})