Skip to content

Commit f7c2743

Browse files
authored
test: remove unnecessary conditionals in error recovery tests (#73625)
This PR removed unnecessary basePath conditional checks.
1 parent d48881e commit f7c2743

File tree

1 file changed

+3
-66
lines changed

1 file changed

+3
-66
lines changed

test/development/basic/hmr/run-error-recovery-hmr-test.util.ts

Lines changed: 3 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export function runErrorRecoveryHmrTest(nextConfig: {
164164
await assertHasRedbox(browser)
165165
const source = next.normalizeTestDirContent(await getRedboxSource(browser))
166166

167-
if (basePath === '' && process.env.IS_TURBOPACK_TEST) {
167+
if (process.env.IS_TURBOPACK_TEST) {
168168
expect(source).toMatchInlineSnapshot(`
169169
"./pages/hmr/about2.js (7:1)
170170
Parsing ecmascript source code failed
@@ -176,7 +176,7 @@ export function runErrorRecoveryHmrTest(nextConfig: {
176176
177177
Unexpected token. Did you mean \`{'}'}\` or \`}\`?"
178178
`)
179-
} else if (basePath === '' && process.env.NEXT_RSPACK) {
179+
} else if (process.env.NEXT_RSPACK) {
180180
expect(trimEndMultiline(source)).toMatchInlineSnapshot(`
181181
"./pages/hmr/about2.js
182182
× Module build failed:
@@ -203,70 +203,7 @@ export function runErrorRecoveryHmrTest(nextConfig: {
203203
Import trace for requested module:
204204
./pages/hmr/about2.js"
205205
`)
206-
} else if (basePath === '') {
207-
expect(source).toMatchInlineSnapshot(`
208-
"./pages/hmr/about2.js
209-
Error: x Unexpected token. Did you mean \`{'}'}\` or \`}\`?
210-
,-[7:1]
211-
4 | <p>This is the about page.</p>
212-
5 | div
213-
6 | )
214-
7 | }
215-
: ^
216-
\`----
217-
x Unexpected eof
218-
,-[7:3]
219-
5 | div
220-
6 | )
221-
7 | }
222-
\`----
223-
224-
Caused by:
225-
Syntax Error
226-
227-
Import trace for requested module:
228-
./pages/hmr/about2.js"
229-
`)
230-
} else if (basePath === '/docs' && process.env.IS_TURBOPACK_TEST) {
231-
expect(source).toMatchInlineSnapshot(`
232-
"./pages/hmr/about2.js (7:1)
233-
Parsing ecmascript source code failed
234-
5 | div
235-
6 | )
236-
> 7 | }
237-
| ^
238-
8 |
239-
240-
Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`?"
241-
`)
242-
} else if (basePath === '/docs' && process.env.NEXT_RSPACK) {
243-
expect(trimEndMultiline(source)).toMatchInlineSnapshot(`
244-
"./pages/hmr/about2.js
245-
× Module build failed:
246-
├─▶ ×
247-
│ │ x Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`?
248-
│ │ ,-[TEST_DIR/pages/hmr/about2.js:7:1]
249-
│ │ 4 | <p>This is the about page.</p>
250-
│ │ 5 | div
251-
│ │ 6 | )
252-
│ │ 7 | }
253-
│ │ : ^
254-
│ │ \`----
255-
│ │
256-
│ │ x Unexpected eof
257-
│ │ ,-[TEST_DIR/pages/hmr/about2.js:7:3]
258-
│ │ 5 | div
259-
│ │ 6 | )
260-
│ │ 7 | }
261-
│ │ \`----
262-
│ │
263-
264-
╰─▶ Syntax Error
265-
266-
Import trace for requested module:
267-
./pages/hmr/about2.js"
268-
`)
269-
} else if (basePath === '/docs') {
206+
} else {
270207
expect(source).toMatchInlineSnapshot(`
271208
"./pages/hmr/about2.js
272209
Error: x Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`?

0 commit comments

Comments
 (0)