avyvar's picture
Add files using upload-large-folder tool
94786da verified
Raw
History Blame Contribute Delete
4.42 kB
diff --git a/test/development/app-dir/special-project-paths/fixtures/app/layout.js b/test/development/app-dir/special-project-paths/fixtures/app/layout.js
new file mode 100644
index 0000000000000000000000000000000000000000..803f17d863c8ad887c14588aab3487e473367b41
--- /dev/null
+++ b/test/development/app-dir/special-project-paths/fixtures/app/layout.js
@@ -0,0 +1,7 @@
+export default function RootLayout({ children }) {
+ return (
+ <html>
+ <body>{children}</body>
+ </html>
+ )
+}
diff --git a/test/development/app-dir/special-project-paths/fixtures/app/ssr-throw/Thrower.js b/test/development/app-dir/special-project-paths/fixtures/app/ssr-throw/Thrower.js
new file mode 100644
index 0000000000000000000000000000000000000000..140fa61e8ba3c0d722afbabe5ba1d69de79bf0f2
--- /dev/null
+++ b/test/development/app-dir/special-project-paths/fixtures/app/ssr-throw/Thrower.js
@@ -0,0 +1,10 @@
+'use client'
+
+function throwError() {
+ throw new Error('ssr-throw')
+}
+
+export function Thrower() {
+ throwError()
+ return null
+}
diff --git a/test/development/app-dir/special-project-paths/fixtures/app/ssr-throw/page.js b/test/development/app-dir/special-project-paths/fixtures/app/ssr-throw/page.js
new file mode 100644
index 0000000000000000000000000000000000000000..d5d6f5cad684f2e81f3c796e9a7e0ede72c95637
--- /dev/null
+++ b/test/development/app-dir/special-project-paths/fixtures/app/ssr-throw/page.js
@@ -0,0 +1,5 @@
+import { Thrower } from './Thrower'
+
+export default function Page() {
+ return <Thrower />
+}
diff --git a/test/development/app-dir/special-project-paths/fixtures/next.config.js b/test/development/app-dir/special-project-paths/fixtures/next.config.js
new file mode 100644
index 0000000000000000000000000000000000000000..4ba52ba2c8df6758685c8f65f490306b5c44eb76
--- /dev/null
+++ b/test/development/app-dir/special-project-paths/fixtures/next.config.js
@@ -0,0 +1 @@
+module.exports = {}
diff --git a/test/development/app-dir/special-project-paths/special-project-paths.test.ts b/test/development/app-dir/special-project-paths/special-project-paths.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..4f5399aff3c8c153fa06a243c81ad8ea6c6ff89d
--- /dev/null
+++ b/test/development/app-dir/special-project-paths/special-project-paths.test.ts
@@ -0,0 +1,66 @@
+import * as path from 'path'
+import { nextTestSetup } from 'e2e-utils'
+import stripAnsi from 'strip-ansi'
+import { getRedboxSource, retry } from 'next-test-utils'
+
+function setup(subDir: string) {
+ return nextTestSetup({
+ files: path.join(__dirname, 'fixtures'),
+ subDir,
+ })
+}
+
+async function assertSymbolicatedSSRError(
+ next: ReturnType<typeof setup>['next']
+) {
+ const outputIndex = next.cliOutput.length
+ const browser = await next.browser('/ssr-throw')
+
+ await retry(() => {
+ expect(next.cliOutput.slice(outputIndex)).toContain('Error: ssr-throw')
+ })
+
+ const cliOutput = stripAnsi(next.cliOutput.slice(outputIndex))
+ expect(cliOutput).toContain('at throwError (app/ssr-throw/Thrower.js:4:9)')
+ expect(cliOutput).toContain('at Thrower (app/ssr-throw/Thrower.js:8:3)')
+ expect(cliOutput).toContain("throw new Error('ssr-throw')")
+
+ let redboxSource: string | null = null
+ await retry(async () => {
+ redboxSource = await getRedboxSource(browser)
+ expect(redboxSource).not.toBeNull()
+ })
+ expect(redboxSource).toContain('app/ssr-throw/Thrower.js (4:9) @ throwError')
+ expect(redboxSource).toContain("throw new Error('ssr-throw')")
+}
+
+// Symbolication must work in project directories whose absolute path
+// contains characters that need percent-encoding in URLs.
+describe('special project paths', () => {
+ describe('in "space dir"', () => {
+ const { skipped, next } = setup('space dir')
+ if (skipped) return
+
+ it('symbolicates thrown SSR errors', async () => {
+ await assertSymbolicatedSSRError(next)
+ })
+ })
+
+ describe('in "ünïcode-dir"', () => {
+ const { skipped, next } = setup('ünïcode-dir')
+ if (skipped) return
+
+ it('symbolicates thrown SSR errors', async () => {
+ await assertSymbolicatedSSRError(next)
+ })
+ })
+
+ describe('in "bracket [dir]"', () => {
+ const { skipped, next } = setup('bracket [dir]')
+ if (skipped) return
+
+ it('symbolicates thrown SSR errors', async () => {
+ await assertSymbolicatedSSRError(next)
+ })
+ })
+})