-
Notifications
You must be signed in to change notification settings - Fork 26.1k
/
index.test.ts
68 lines (62 loc) · 1.54 KB
/
index.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { createNext } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { renderViaHTTP } from 'next-test-utils'
describe('swc warnings by default', () => {
let next: NextInstance
beforeAll(async () => {
next = await createNext({
files: {
'pages/index.js': `
export default function Page() {
return <p>hello world</p>
}
`,
'.babelrc': `
{
"presets": ["next/babel"]
}
`,
},
dependencies: {},
})
})
afterAll(() => next.destroy())
it('should have warning', async () => {
await renderViaHTTP(next.url, '/')
expect(next.cliOutput).toContain(
'Disabled SWC as replacement for Babel because of custom Babel configuration'
)
})
})
describe('can force swc', () => {
let next: NextInstance
beforeAll(async () => {
next = await createNext({
nextConfig: {
experimental: {
forceSwcTransforms: true,
},
},
files: {
'pages/index.js': `
export default function Page() {
return <p>hello world</p>
}
`,
'.babelrc': `
{
"presets": ["next/babel"]
}
`,
},
dependencies: {},
})
})
afterAll(() => next.destroy())
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'
)
})
})