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

41 lines
1.3 KiB
TypeScript

import { nextTestSetup } from 'e2e-utils'
import {
getRedboxDescription,
getRedboxSource,
waitForRedbox,
} from 'next-test-utils'
describe('Invalid Image Import (dev)', () => {
const { next, isTurbopack } = nextTestSetup({
files: __dirname,
})
it('should show error', async () => {
const browser = await next.browser('/')
await waitForRedbox(browser)
const description = await getRedboxDescription(browser)
if (isTurbopack) {
expect(description).toContain('Processing image failed')
} else {
expect(description).toContain(
'Image import "../public/invalid.svg" is not a valid image file. The image may be corrupted or an unsupported format.'
)
}
const source = await getRedboxSource(browser)
if (isTurbopack) {
expect(source).toContain('Processing image failed')
expect(source).toContain(
'Failed to parse svg source code for image dimensions'
)
expect(source).toContain(
'Source code does not contain a <svg> root element'
)
} else {
expect(source).toContain('./pages/index.js')
expect(source).toContain(
'Image import "../public/invalid.svg" is not a valid image file. The image may be corrupted or an unsupported format.'
)
}
})
})