Unverified Commit f7c27432 authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

test: remove unnecessary conditionals in error recovery tests (#73625)

This PR removed unnecessary basePath conditional checks.
parent d48881e4
...@@ -164,70 +164,7 @@ export function runErrorRecoveryHmrTest(nextConfig: { ...@@ -164,70 +164,7 @@ export function runErrorRecoveryHmrTest(nextConfig: {
await assertHasRedbox(browser) await assertHasRedbox(browser)
const source = next.normalizeTestDirContent(await getRedboxSource(browser)) const source = next.normalizeTestDirContent(await getRedboxSource(browser))
if (basePath === '' && process.env.IS_TURBOPACK_TEST) { if (process.env.IS_TURBOPACK_TEST) {
expect(source).toMatchInlineSnapshot(`
"./pages/hmr/about2.js (7:1)
Parsing ecmascript source code failed
5 | div
6 | )
> 7 | }
| ^
8 |
Unexpected token. Did you mean \`{'}'}\` or \`}\`?"
`)
} else if (basePath === '' && process.env.NEXT_RSPACK) {
expect(trimEndMultiline(source)).toMatchInlineSnapshot(`
"./pages/hmr/about2.js
× Module build failed:
├─▶ ×
│ │ x Unexpected token. Did you mean \`{'}'}\` or \`}\`?
│ │ ,-[TEST_DIR/pages/hmr/about2.js:7:1]
│ │ 4 | <p>This is the about page.</p>
│ │ 5 | div
│ │ 6 | )
│ │ 7 | }
│ │ : ^
│ │ \`----
│ │
│ │ x Unexpected eof
│ │ ,-[TEST_DIR/pages/hmr/about2.js:7:3]
│ │ 5 | div
│ │ 6 | )
│ │ 7 | }
│ │ \`----
│ │
│
╰─▶ Syntax Error
Import trace for requested module:
./pages/hmr/about2.js"
`)
} else if (basePath === '') {
expect(source).toMatchInlineSnapshot(`
"./pages/hmr/about2.js
Error: x Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`?
,-[7:1]
4 | <p>This is the about page.</p>
5 | div
6 | )
7 | }
: ^
\`----
x Unexpected eof
,-[7:3]
5 | div
6 | )
7 | }
\`----
Caused by:
Syntax Error
Import trace for requested module:
./pages/hmr/about2.js"
`)
} else if (basePath === '/docs' && process.env.IS_TURBOPACK_TEST) {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./pages/hmr/about2.js (7:1) "./pages/hmr/about2.js (7:1)
Parsing ecmascript source code failed Parsing ecmascript source code failed
...@@ -239,7 +176,7 @@ export function runErrorRecoveryHmrTest(nextConfig: { ...@@ -239,7 +176,7 @@ export function runErrorRecoveryHmrTest(nextConfig: {
Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`?" Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`?"
`) `)
} else if (basePath === '/docs' && process.env.NEXT_RSPACK) { } else if (process.env.NEXT_RSPACK) {
expect(trimEndMultiline(source)).toMatchInlineSnapshot(` expect(trimEndMultiline(source)).toMatchInlineSnapshot(`
"./pages/hmr/about2.js "./pages/hmr/about2.js
× Module build failed: × Module build failed:
...@@ -266,7 +203,7 @@ export function runErrorRecoveryHmrTest(nextConfig: { ...@@ -266,7 +203,7 @@ export function runErrorRecoveryHmrTest(nextConfig: {
Import trace for requested module: Import trace for requested module:
./pages/hmr/about2.js" ./pages/hmr/about2.js"
`) `)
} else if (basePath === '/docs') { } else {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./pages/hmr/about2.js "./pages/hmr/about2.js
Error: x Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`? Error: x Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment