diff --git a/test/integration/dynamic-routing/pages/d/[id].js b/test/integration/dynamic-routing/pages/d/[id].js
new file mode 100644
index 0000000000000..b17ed24dd8220
--- /dev/null
+++ b/test/integration/dynamic-routing/pages/d/[id].js
@@ -0,0 +1,9 @@
+import { useRouter } from 'next/router'
+
+const Page = () => {
+ const router = useRouter()
+ const { query } = router
+ return
This is {query.id}
+}
+
+export default Page
diff --git a/test/integration/dynamic-routing/pages/index.js b/test/integration/dynamic-routing/pages/index.js
index bf9583e84609c..c6bf5d0c59eb6 100644
--- a/test/integration/dynamic-routing/pages/index.js
+++ b/test/integration/dynamic-routing/pages/index.js
@@ -1,6 +1,15 @@
import Link from 'next/link'
import { useRouter } from 'next/router'
+if (typeof window !== 'undefined') {
+ window.caughtWarns = []
+ const origWarn = window.console.warn
+ window.console.warn = function (...args) {
+ window.caughtWarns.push(args)
+ origWarn(...args)
+ }
+}
+
const Page = () => {
return (
)
diff --git a/test/integration/dynamic-routing/test/index.test.js b/test/integration/dynamic-routing/test/index.test.js
index a4ec4616e4c91..5427e53c2403b 100644
--- a/test/integration/dynamic-routing/test/index.test.js
+++ b/test/integration/dynamic-routing/test/index.test.js
@@ -84,6 +84,31 @@ function runTests(dev) {
expect(url).toBe('?fromHome=true')
})
+ if (dev) {
+ it('should not have any console warnings on initial load', async () => {
+ const browser = await webdriver(appPort, '/')
+ expect(await browser.eval('window.caughtWarns')).toEqual([])
+ })
+
+ it('should not have any console warnings when navigating to dynamic route', async () => {
+ let browser
+ try {
+ browser = await webdriver(appPort, '/')
+ await browser.eval('window.beforeNav = 1')
+ await browser.elementByCss('#dynamic-route-no-as').click()
+ await browser.waitForElementByCss('#asdf')
+
+ expect(await browser.eval('window.beforeNav')).toBe(1)
+
+ const text = await browser.elementByCss('#asdf').text()
+ expect(text).toMatch(/this is.*?dynamic-1/i)
+ expect(await browser.eval('window.caughtWarns')).toEqual([])
+ } finally {
+ if (browser) await browser.close()
+ }
+ })
+ }
+
it('should navigate to a dynamic page successfully', async () => {
let browser
try {
@@ -893,6 +918,14 @@ function runTests(dev) {
helloworld: 'hello-world',
},
},
+ {
+ namedRegex: '^/d/(?[^/]+?)(?:/)?$',
+ page: '/d/[id]',
+ regex: normalizeRegEx('^\\/d\\/([^\\/]+?)(?:\\/)?$'),
+ routeKeys: {
+ id: 'id',
+ },
+ },
{
namedRegex: '^/dash/(?[^/]+?)(?:/)?$',
page: '/dash/[hello-world]',