mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What? * remove custom next-* conditions * add `foreign` condition * allow `false` in turbo.rules * improve schema for turbo.rules ### Why? ### How? Closes PACK-2913 --------- Co-authored-by: Tim Neutkens <[email protected]>
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
|
|
describe('webpack-loader-conditions', () => {
|
|
const { next, isTurbopack } = nextTestSetup({
|
|
files: __dirname,
|
|
})
|
|
|
|
if (!isTurbopack) {
|
|
it('should only run the test in turbopack', () => {})
|
|
return
|
|
}
|
|
|
|
it('should render correctly on server site', async () => {
|
|
const res = await next.fetch('/')
|
|
const html = (await res.text()).replaceAll(/<!-- -->/g, '')
|
|
expect(html).toContain(`server: {"default":true}`)
|
|
expect(html).toContain(`client: {"default":true}`)
|
|
expect(html).toContain(`foreignClient: {}`)
|
|
})
|
|
|
|
it('should render correctly on client side', async () => {
|
|
const browser = await next.browser('/')
|
|
const text = await browser.elementByCss('body').text()
|
|
expect(text).toContain(`server: ${JSON.stringify({ default: true })}`)
|
|
expect(text).toContain(`client: ${JSON.stringify({ browser: true })}`)
|
|
expect(text).toContain(
|
|
`foreignClient: ${JSON.stringify({ browser: true, foreign: true })}`
|
|
)
|
|
})
|
|
})
|