Files
4588a73542 Convert tests using createNext -> nextTestSetup (#93767)
## What?

Converts existing `createNext()` usage into `nextTestSetup()`. 

`createNext()` was the setup step we had before `nextTestSetup()` was
added.

This PR focused on the simple conversion cases. There will be a
follow-up to complete the last few.

---------

Co-authored-by: Cursor <[email protected]>
2026-05-12 13:16:31 +02:00

66 lines
1.5 KiB
TypeScript

import { nextTestSetup } from 'e2e-utils'
import { renderViaHTTP } from 'next-test-utils'
// Tests Babel, not needed for Turbopack
;(process.env.IS_TURBOPACK_TEST ? describe.skip : describe)(
'swc warnings by default',
() => {
const { next } = nextTestSetup({
files: {
'pages/index.js': `
export default function Page() {
return <p>hello world</p>
}
`,
'.babelrc': `
{
"presets": ["next/babel"]
}
`,
},
dependencies: {},
})
it('should have warning', async () => {
await renderViaHTTP(next.url, '/')
expect(next.cliOutput).toContain(
'Disabled SWC as replacement for Babel because of custom Babel configuration'
)
})
}
)
// Tests Babel, not needed for Turbopack
;(process.env.IS_TURBOPACK_TEST ? describe.skip : describe)(
'can force swc',
() => {
const { next } = nextTestSetup({
nextConfig: {
experimental: {
forceSwcTransforms: true,
},
},
files: {
'pages/index.js': `
export default function Page() {
return <p>hello world</p>
}
`,
'.babelrc': `
{
"presets": ["next/babel"]
}
`,
},
dependencies: {},
})
it('should not have warning', async () => {
await renderViaHTTP(next.url, '/')
expect(next.cliOutput).not.toContain(
'Disabled SWC as replacement for Babel because of custom Babel configuration'
)
})
}
)