fix(test): wrap async provider/hook updates in act() to clear CI log noise#3820
Merged
Conversation
…noise
Many synchronous render-and-assert tests rendered providers/hooks whose
async useEffect work (KeyStore reads, SDK init, Apollo queries, animations)
resolved after the test body returned -- outside act() -- emitting
"An update to <Component> inside a test was not wrapped in act(...)" warnings
that flooded the Concourse/CI logs across many suites (252 warnings total).
Add a shared __tests__/helpers/flush-effects.ts helper (flushEffects) that
settles pending promises/microtasks inside act() via a setImmediate drain --
deeper than a bare `await act(async () => {})`, which several suites already
had yet still warned through. Apply it across 28 suites; for real-timer
animations (StepsProgressBar, react-native-modal) and fake-timer suites, use
the idiomatic act()-wrapped timer advance instead.
No production code, console.error suppression, or assertion changes -- the
warnings are resolved by awaiting the async settle, not masked.
Result: act(...) warnings 252 -> 0 codebase-wide; tsc and eslint clean; no
new test failures.
Closes #3814
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
esaugomez31
approved these changes
Jun 3, 2026
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.
What
Fixes #3814 —
act(...)warnings flooding Concourse/CI logs across many test suites.Many synchronous render-and-assert tests render providers/hooks whose async
useEffectwork (KeyStore reads, SDK init, Apollo queries, animations) resolves after the synchronous test body returns — outsideact()— emitting:These are benign (tests pass) but produced 252
console.errorwarnings codebase-wide, burying real failures in CI output.How
__tests__/helpers/flush-effects.ts→flushEffects(), which settles pending promises/microtasks insideact()via asetImmediatedrain. This is deeper than a bareawait act(async () => {})— several suites already had that and still warned through.StepsProgressBar~120ms,react-native-modal~300–400ms) and fake-timer suites wheresetImmediateflushing doesn't apply, use the idiomaticact()-wrapped timer advance instead.This resolves the warnings by properly awaiting async initialization — it does not suppress them. No
console.errormocking, no production code changes, no weakened assertions.Verification
act(...)warnings (full suite)tsc -p .eslint(changed files)Out of scope (pre-existing)
__tests__/components/blink-card/blink-card.spec.tsx › displays valid thru datefails on a date-sensitive assertion (12/ 28vs11/ 28) on the untouched baseline too — a separate, pre-existing issue not addressed here.🤖 Generated with Claude Code