Skip to content

Commit 7b9999e

Browse files
Merge pull request #6936 from Shopify/fix-flaky
Fix flaky test on AutocompletePrompt.test.tsx
2 parents 0202391 + afea463 commit 7b9999e

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

packages/cli-kit/src/private/node/testing/ui.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ export async function sendInputAndWaitForContent(
177177
...inputs: string[]
178178
) {
179179
await waitForContent(renderInstance, content, () => inputs.forEach((input) => renderInstance.stdin.write(input)))
180+
// Yield so React 19's scheduler can flush effects (e.g. re-register useInput
181+
// handlers with up-to-date closures) before subsequent input is sent.
182+
await new Promise((resolve) => setImmediate(() => setTimeout(resolve, 0)))
180183
}
181184

182185
/** Function that is useful when you want to check the last frame of a component that unmounted.

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)