Skip to content

test: fail on act warnings and keep one render per test - #3501

Merged
setchy merged 1 commit into
mainfrom
test/act-warning-gate
Oct 25, 2026
Merged

setchy merged 1 commit into
mainfrom
test/act-warning-gate

Conversation

@setchy

@setchy setchy commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add a shared setup that fails a test when React logs an act(...) warning.
  • Flush queued work and unmount cleanup before asserting, so warnings emitted during teardown are caught.
  • Split the AccountHeader “labels the toggle by collapsed state” test into two independent tests (expanded and collapsed).

Why

Act warnings are test bugs (a store update or promise resolving outside act) but were only visible in logs. The gate makes them fail where they happen. The split removes the last in-test remount pattern; each test now owns its render.

Verification

  • pnpm test: 200 files, 1,968 tests passed
  • pnpm exec vp check --no-fmt: 464 files passed

@setchy
setchy requested a review from afonsojramos as a code owner October 25, 2026 13:31
@github-actions github-actions Bot added the test Enhancements to test coverage or quality label Oct 25, 2026
Add a setup that fails a test when React reports an update outside act, after flushing queued work and unmount cleanup. Split the AccountHeader collapsed/expanded assertion into two independent tests.
@setchy
setchy force-pushed the test/act-warning-gate branch from e4f848c to 4148345 Compare October 25, 2026 13:34
@sonarqubecloud

Copy link
Copy Markdown

@setchy
setchy merged commit a9b79bb into main Oct 25, 2026
23 checks passed
@setchy
setchy deleted the test/act-warning-gate branch October 25, 2026 13:38
@github-actions github-actions Bot added this to the Release 7.11.0 milestone Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Enhancements to test coverage or quality

Development

Successfully merging this pull request may close these issues.

1 participant