Files
b912492392 Turbopack: import webpack loader rules conditions (#64205)
### 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]>
2024-04-11 17:35:43 +02:00

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: {&quot;default&quot;:true}`)
expect(html).toContain(`client: {&quot;default&quot;: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 })}`
)
})
})