From afea4638c06ae0ba3c6aceeb2afa9855947357a1 Mon Sep 17 00:00:00 2001 From: Gonzalo Riestra Date: Wed, 4 Mar 2026 12:57:54 +0100 Subject: [PATCH] Fix flaky test on AutocompletePrompt.test.tsx --- packages/cli-kit/src/private/node/testing/ui.ts | 3 +++ pnpm-lock.yaml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/cli-kit/src/private/node/testing/ui.ts b/packages/cli-kit/src/private/node/testing/ui.ts index 13c5019050..5db5d37da9 100644 --- a/packages/cli-kit/src/private/node/testing/ui.ts +++ b/packages/cli-kit/src/private/node/testing/ui.ts @@ -177,6 +177,9 @@ export async function sendInputAndWaitForContent( ...inputs: string[] ) { await waitForContent(renderInstance, content, () => inputs.forEach((input) => renderInstance.stdin.write(input))) + // Yield so React 19's scheduler can flush effects (e.g. re-register useInput + // handlers with up-to-date closures) before subsequent input is sent. + await new Promise((resolve) => setImmediate(() => setTimeout(resolve, 0))) } /** Function that is useful when you want to check the last frame of a component that unmounted. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7a9a193f3f..0b5d9644a4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17187,7 +17187,7 @@ snapshots: hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3 - minimatch: 3.1.2 + minimatch: 3.1.5 object.fromentries: 2.0.8 object.groupby: 1.0.3 object.values: 1.2.1