Skip to content

Commit ac454e9

Browse files
committed
add test for config compat
1 parent b00bb8e commit ac454e9

File tree

6 files changed

+76
-0
lines changed

6 files changed

+76
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default function RootLayout({ children }) {
2+
return (
3+
<html lang="en">
4+
<body>{children}</body>
5+
</html>
6+
)
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import foo from 'foo'
2+
3+
export default function Page() {
4+
return <div id="result">Hello {foo}</div>
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { nextTestSetup } from 'e2e-utils'
2+
3+
describe('turbopack-turbo-config-compatibility', () => {
4+
describe('including both turbopack and deprecated experimental turbo config', () => {
5+
const { next, isTurbopack } = nextTestSetup({
6+
files: __dirname,
7+
})
8+
9+
if (!isTurbopack) {
10+
return
11+
}
12+
13+
it('prefers turbopack config over deprecated experimental turbo config', async () => {
14+
const $ = await next.render$('/')
15+
expect($('#result').text()).toEqual('Hello turbopack')
16+
})
17+
})
18+
19+
describe('only including deprecated experimental turbo config', () => {
20+
const { next, isTurbopack } = nextTestSetup({
21+
files: __dirname,
22+
})
23+
24+
if (!isTurbopack) {
25+
return
26+
}
27+
28+
beforeAll(async () => {
29+
await next.patchFile(
30+
'next.config.js',
31+
`module.exports = {
32+
experimental: {
33+
turbo: {
34+
resolveAlias: {
35+
foo: './turbo.js',
36+
},
37+
},
38+
},
39+
}`
40+
)
41+
})
42+
43+
it('still uses the deprecated experimental turbo config', async () => {
44+
const $ = await next.render$('/')
45+
expect($('#result').text()).toEqual('Hello turbo')
46+
})
47+
})
48+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
turbopack: {
3+
resolveAlias: {
4+
foo: './turbopack.js',
5+
},
6+
},
7+
experimental: {
8+
turbo: {
9+
resolveAlias: {
10+
foo: './turbo.js',
11+
},
12+
},
13+
},
14+
}
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'turbo'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'turbopack'

0 commit comments

Comments
 (0)