Skip to content

fix(test): wrap async provider/hook updates in act() to clear CI log noise#3820

Merged
grimen merged 1 commit into
mainfrom
fix/test-act-warnings-3814
Jun 3, 2026
Merged

fix(test): wrap async provider/hook updates in act() to clear CI log noise#3820
grimen merged 1 commit into
mainfrom
fix/test-act-warnings-3814

Conversation

@grimen

@grimen grimen commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

What

Fixes #3814act(...) warnings flooding Concourse/CI logs across many test suites.

Many synchronous render-and-assert tests render providers/hooks whose async useEffect work (KeyStore reads, SDK init, Apollo queries, animations) resolves after the synchronous test body returns — outside act() — emitting:

An update to <Component> inside a test was not wrapped in act(...).

These are benign (tests pass) but produced 252 console.error warnings codebase-wide, burying real failures in CI output.

How

  • Add shared helper __tests__/helpers/flush-effects.tsflushEffects(), which settles pending promises/microtasks inside act() via a setImmediate drain. This is deeper than a bare await act(async () => {}) — several suites already had that and still warned through.
  • Apply it across 28 suites to await the async settle in the affected synchronous tests.
  • For real-timer animations (StepsProgressBar ~120ms, react-native-modal ~300–400ms) and fake-timer suites where setImmediate flushing doesn't apply, use the idiomatic act()-wrapped timer advance instead.

This resolves the warnings by properly awaiting async initialization — it does not suppress them. No console.error mocking, no production code changes, no weakened assertions.

Verification

Check Result
act(...) warnings (full suite) 252 → 0
Full test suite no new failures
tsc -p . ✅ pass
eslint (changed files) ✅ pass

Out of scope (pre-existing)

__tests__/components/blink-card/blink-card.spec.tsx › displays valid thru date fails on a date-sensitive assertion (12/ 28 vs 11/ 28) on the untouched baseline too — a separate, pre-existing issue not addressed here.

🤖 Generated with Claude Code

…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>
@grimen grimen merged commit f807ab6 into main Jun 3, 2026
6 of 8 checks passed
@grimen grimen deleted the fix/test-act-warnings-3814 branch June 3, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(test): act(...) warnings flood Concourse/CI logs with gibberish across many test suites

2 participants