avyvar's picture
Add files using upload-large-folder tool
94786da verified
Raw
History Blame Contribute Delete
3.7 kB
diff --git a/test/production/debug-build-path/fixtures/default/app/robots.metadata.ts b/test/production/debug-build-path/fixtures/default/app/robots.metadata.ts
new file mode 100644
index 0000000000000000000000000000000000000000..309e3e197d231f2a9ea60926a67b9c6456c65b56
--- /dev/null
+++ b/test/production/debug-build-path/fixtures/default/app/robots.metadata.ts
@@ -0,0 +1,8 @@
+export default function robots() {
+ return {
+ rules: {
+ userAgent: '*',
+ allow: '/',
+ },
+ }
+}
diff --git a/test/production/debug-build-path/fixtures/default/app/sitemap.metadata.ts b/test/production/debug-build-path/fixtures/default/app/sitemap.metadata.ts
new file mode 100644
index 0000000000000000000000000000000000000000..7d37bfe091ebf1a2c2cbc1d9e32ea654acbb39c8
--- /dev/null
+++ b/test/production/debug-build-path/fixtures/default/app/sitemap.metadata.ts
@@ -0,0 +1,3 @@
+export default function sitemap() {
+ return [{ url: 'https://example.com' }]
+}
diff --git a/test/production/debug-build-path/fixtures/default/next.config.js b/test/production/debug-build-path/fixtures/default/next.config.js
index 767719fc4fba59345ae29e29159c9aff270f5819..af7a39f7888845358a628ac3f0e2e2a2130754de 100644
--- a/test/production/debug-build-path/fixtures/default/next.config.js
+++ b/test/production/debug-build-path/fixtures/default/next.config.js
@@ -1,4 +1,6 @@
/** @type {import('next').NextConfig} */
-const nextConfig = {}
+const nextConfig = {
+ pageExtensions: ['metadata.ts', 'js', 'jsx', 'ts', 'tsx'],
+}
module.exports = nextConfig
diff --git a/test/production/debug-build-path/metadata-routes.test.ts b/test/production/debug-build-path/metadata-routes.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..eb06963fafb3fc74463da0c1a352da5628d0a884
--- /dev/null
+++ b/test/production/debug-build-path/metadata-routes.test.ts
@@ -0,0 +1,26 @@
+import path from 'path'
+import { nextTestSetup } from 'e2e-utils'
+
+describe('debug-build-paths metadata routes', () => {
+ const { next } = nextTestSetup({
+ files: path.join(__dirname, 'fixtures/default'),
+ skipStart: true,
+ env: {
+ __NEXT_PRIVATE_DETERMINISTIC_BUILD_OUTPUT: '1',
+ },
+ })
+
+ it('selectively builds App Router metadata routes', async () => {
+ const result = await next.build({
+ args: [
+ '--debug-build-paths',
+ 'app/robots.metadata.ts,app/sitemap.metadata.ts',
+ ],
+ })
+
+ expect(result.exitCode).toBe(0)
+ expect(result.cliOutput).toContain('/robots.txt')
+ expect(result.cliOutput).toContain('/sitemap.xml')
+ expect(result.cliOutput).not.toContain('/about')
+ })
+})
diff --git a/test/production/debug-build-path/page-route.test.ts b/test/production/debug-build-path/page-route.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6febe039083cf070a099aae81574fb70a18a7ee1
--- /dev/null
+++ b/test/production/debug-build-path/page-route.test.ts
@@ -0,0 +1,23 @@
+import path from 'path'
+import { nextTestSetup } from 'e2e-utils'
+
+describe('debug-build-paths page route regression', () => {
+ const { next } = nextTestSetup({
+ files: path.join(__dirname, 'fixtures/default'),
+ skipStart: true,
+ env: {
+ __NEXT_PRIVATE_DETERMINISTIC_BUILD_OUTPUT: '1',
+ },
+ })
+
+ it('continues to selectively build a regular App Router page', async () => {
+ const result = await next.build({
+ args: ['--debug-build-paths', 'app/about/page.tsx'],
+ })
+
+ expect(result.exitCode).toBe(0)
+ expect(result.cliOutput).toContain('/about')
+ expect(result.cliOutput).not.toContain('/robots.txt')
+ expect(result.cliOutput).not.toContain('/sitemap.xml')
+ })
+})