Unverified Commit 3192e47e authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

test: stabilize lazy dynamic import error overlay (#98730)

### What?

Stabilizes the Turbopack development test that verifies an invalid
dynamic-import target stays unparsed until activation, while checking
both server compilation output and the browser-visible error overlay
afterward.

### Why?

Activating the target can trigger an incidental hard reload as Fast
Refresh recovers from the error. A one-shot overlay source read can race
that document replacement. The test should check the error it owns
without requiring a reload or accepting an absent overlay.

### How?

The test retains canary's CLI-output assertion and independently retries
a live browser-redbox source assertion filtered to the expected
parse-error marker. Playwright re-resolves the locator across document
changes; both signals must actually contain the marker.

### Verification

- Focused Turbopack dev case under six competing CPU workers: 20/20
passed on rebased canary
- Complete `lazy-dynamic-imports` Turbopack dev file: 3/3 passed on
rebased canary
- Related `next/dynamic` error-overlay case: 10/10 passed on rebased
canary
- Prettier, ESLint, clean merge-tree, and diff checks

<!-- NEXT_JS_LLM -->

<!-- fleet 2dd4f041-bfb3-4572-9b57-5cb45a2410cd -->

---------
Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
Co-authored-by: 's avatarTobias Koppers <1365881+sokra@users.noreply.github.com>
parent fea76de6
......@@ -261,6 +261,16 @@ export const invalid = ;`
'parse-error-proves-target-was-analyzed'
)
})
const source = browser
.locateRedbox()
.locator('[data-nextjs-codeframe], [data-nextjs-terminal]', {
hasText: 'parse-error-proves-target-was-analyzed',
})
await retry(async () => {
expect(await source.innerText()).toContain(
'parse-error-proves-target-was-analyzed'
)
})
} finally {
await next.patchFile(targetPath, originalTarget)
await next.patchFile(demoPath, originalDemo)
......
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