Fix flaky test in usePollAppLogs.test.tsx#7089
Merged
gonzaloriestra merged 1 commit intomainfrom Mar 24, 2026
Merged
Conversation
Contributor
Coverage report
Test suite run success3933 tests passing in 1514 suites. Report generated by 🧪jest coverage report action from dd5a291 |
Contributor
|
We detected some changes at Caution DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release. |
isaacroldan
approved these changes
Mar 24, 2026
dmerand
approved these changes
Mar 24, 2026
Contributor
Author
Merge activity
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
Fixes flaky test
usePollAppLogs > retries after unknown error:Example: https://github.com/Shopify/cli/actions/runs/23492398606/job/68363913877
WHAT is this pull request doing?
The test asserted on
hook.lastResult?.errorsimmediately afteradvanceTimersByTimeAsync(0), but the async poll chain (performPoll→await pollAppLogs()→await handleFetchAppLogsError()→setErrors()) could still be in-flight, so React hadn't flushed the state update yet.Added
waitForMockCalls+ an extraadvanceTimersByTimeAsync(0)to drain microtasks and flush React 19 batched state updates before asserting — matching the pattern already used by the other passing tests in the same file. Applied the same fix to the "retries after throttle interval on 429" test which had the identical race condition.How to test your changes?
CI
Measuring impact
How do we know this change was effective? Please choose one:
Checklist