Skip to content

Commit 3a43359

Browse files
committed
add a test
1 parent ce91f17 commit 3a43359

File tree

6 files changed

+77
-0
lines changed

6 files changed

+77
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { nextTestSetup } from 'e2e-utils'
2+
import path from 'path'
3+
4+
describe('deprecation-warnings', () => {
5+
describe('without next.config.js', () => {
6+
const { next } = nextTestSetup({
7+
files: path.join(__dirname, 'fixtures/no-config'),
8+
skipStart: true,
9+
})
10+
11+
it('should not emit any deprecation warnings when no config file exists', async () => {
12+
await next.start()
13+
14+
const logs = next.cliOutput
15+
expect(logs).not.toContain('deprecated')
16+
expect(logs).not.toContain('has been renamed')
17+
expect(logs).not.toContain('no longer needed')
18+
})
19+
})
20+
21+
describe('with deprecated config options', () => {
22+
const { next } = nextTestSetup({
23+
files: path.join(__dirname, 'fixtures/with-deprecated-config'),
24+
skipStart: true,
25+
})
26+
27+
it('should emit deprecation warnings for explicitly configured deprecated options', async () => {
28+
await next.start()
29+
30+
const logs = next.cliOutput
31+
32+
// Should warn about amp configuration
33+
expect(logs).toContain('Built-in amp support is deprecated')
34+
35+
// Should warn about experimental.instrumentationHook
36+
expect(logs).toContain('experimental.instrumentationHook')
37+
expect(logs).toContain('no longer needed')
38+
})
39+
})
40+
})
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default function RootLayout({
2+
children,
3+
}: {
4+
children: React.ReactNode
5+
}) {
6+
return (
7+
<html lang="en">
8+
<body>{children}</body>
9+
</html>
10+
)
11+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Page() {
2+
return <div>Hello World</div>
3+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default function RootLayout({
2+
children,
3+
}: {
4+
children: React.ReactNode
5+
}) {
6+
return (
7+
<html lang="en">
8+
<body>{children}</body>
9+
</html>
10+
)
11+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Page() {
2+
return <div>Hello World</div>
3+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
// Explicitly configure deprecated options
3+
amp: {
4+
canonicalBase: 'https://example.com',
5+
},
6+
experimental: {
7+
instrumentationHook: true,
8+
},
9+
}

0 commit comments

Comments
 (0)