Unverified Commit e9c16094 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

Fix flaky successive HMR changes test (#97610)

### What?

Correct the fixture marker used to construct the second invalid source
state in the successive App Router HMR test.

### Why?

The test was replacing a marker that does not exist in its MDX fixture.
Because string replacement silently returned the original content,
supposedly successive patches sometimes wrote byte-identical source
while the test harness waited for an HMR completion callback.

A no-op write does not have to produce an HMR update, so the callback
could remain pending until the harness reported a misleading timeout. CI
logs showed Fast Refresh itself completing quickly, which ruled out an
insufficient timeout budget and made extending the timeout the wrong
fix.

### How?

Match the replacement to the fixture's actual marker. This restores four
genuinely distinct source states in every error/recovery cycle,
preserving the intended overlay coverage without changing Turbopack, the
shared HMR helper, or its timeout.

### Verification

- `pnpm test-dev-turbo
test/development/acceptance-app/app-hmr-changes.test.ts`
- Repeated the focused test three times under 14 CPU-contention workers
- Prettier and ESLint on the changed test file

<!-- NEXT_JS_LLM -->

---------
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 6ef6e29d
...@@ -265,6 +265,13 @@ export function processMessage( ...@@ -265,6 +265,13 @@ export function processMessage(
) )
} }
dispatcher.onBuildOk() dispatcher.onBuildOk()
// A successful build can be a no-op after recovering from an error, so
// there may be no server component change to resolve the test callback.
if (process.env.__NEXT_TEST_MODE && self.__NEXT_HMR_CB) {
self.__NEXT_HMR_CB()
self.__NEXT_HMR_CB = null
}
} else { } else {
tryApplyUpdatesWebpack(sendMessage) tryApplyUpdatesWebpack(sendMessage)
} }
......
...@@ -43,7 +43,7 @@ describe('Error overlay - RSC build errors', () => { ...@@ -43,7 +43,7 @@ describe('Error overlay - RSC build errors', () => {
await session.patch(pagePath, break1) await session.patch(pagePath, break1)
const break2 = break1.replace('{/* break point 2 */}', '<Figure />') const break2 = break1.replace('break 2', '<Figure />')
await session.patch(pagePath, break2) await session.patch(pagePath, break2)
......
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