Skip to content

Commit 5a50696

Browse files
committed
Add test
1 parent 192ef57 commit 5a50696

File tree

6 files changed

+58
-0
lines changed

6 files changed

+58
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { ReactNode } from 'react'
2+
export default function Root({ children }: { children: ReactNode }) {
3+
return (
4+
<html>
5+
<body>{children}</body>
6+
</html>
7+
)
8+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import getConfig from 'next/config'
2+
3+
export default function Page() {
4+
getConfig()
5+
return <p>hello world</p>
6+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { nextTestSetup } from 'e2e-utils'
2+
3+
describe('deprecation-warning-runtime-config', () => {
4+
const { next } = nextTestSetup({
5+
files: __dirname,
6+
})
7+
8+
it('should warn when imported "next/config" module', async () => {
9+
// Navigate to "/" for dev server to execute the code
10+
await next.browser('/')
11+
12+
expect(next.cliOutput).toContain(
13+
'Runtime config is deprecated and will be removed in Next.js 16. Please remove the usage of "next/config" from your project.'
14+
)
15+
})
16+
})
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @type {import('next').NextConfig}
3+
*/
4+
const nextConfig = {
5+
publicRuntimeConfig: {
6+
foo: 'bar',
7+
},
8+
serverRuntimeConfig: {
9+
foo: 'bar',
10+
},
11+
}
12+
13+
module.exports = nextConfig

test/e2e/deprecation-warnings/deprecation-warnings.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ describe('deprecation-warnings', () => {
3232
// Should warn about experimental.instrumentationHook
3333
expect(logs).toContain('experimental.instrumentationHook')
3434
expect(logs).toContain('no longer needed')
35+
36+
// Should warn about publicRuntimeConfig
37+
expect(logs).toContain('publicRuntimeConfig')
38+
expect(logs).toContain('will be removed in Next.js 16')
39+
40+
// Should warn about serverRuntimeConfig
41+
expect(logs).toContain('serverRuntimeConfig')
42+
expect(logs).toContain('will be removed in Next.js 16')
3543
})
3644
})
3745
})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
/** @type {import('next').NextConfig} */
12
module.exports = {
23
// Explicitly configure deprecated options
34
experimental: {
45
instrumentationHook: true,
56
},
7+
publicRuntimeConfig: {
8+
foo: 'bar',
9+
},
10+
serverRuntimeConfig: {
11+
foo: 'bar',
12+
},
613
}

0 commit comments

Comments
 (0)