Skip to content

DEX-241: Fix FE test teardown leaks and flaky act() failures - #213

Merged
cvburgess merged 4 commits into
mainfrom
dex-241-fix-fe-test-teardown-leak-and-flaky-usenotes-act-failure
Oct 20, 2026
Merged

cvburgess merged 4 commits into
mainfrom
dex-241-fix-fe-test-teardown-leak-and-flaky-usenotes-act-failure

Conversation

@cvburgess

Copy link
Copy Markdown
Owner

Summary

  • HabitRing stops its animations on unmount. Its two Animated.timing calls were never stopped, so a ring unmounted mid-fill kept scheduling rAF frames. In Jest this caused the "environment has been torn down" ReferenceError from HabitTracker.test.tsx on every run, because the future-day case unmounts within the 300ms animation.
  • useNotes / useLists mutation tests now end on settleQueries. Before, they ended on a mock's call count, so react-query's late notifications landed in the next test. That's the CI flake in useNotes › rolls back the optimistic note…. Stress results: useNotes failed 1 in 24 parallel runs before and 0 in 48 after.
  • Dropped --forceExit. jest.setup.js now installs a react-query timeoutManager provider that unref()s its timers, so the un-cleared QueryClient gc timers (5 min) no longer hold workers open. They still fire; they just don't block exit. This removes the "worker process has failed to exit gracefully" warning, and from now on that warning means a real leak.
    • The provider shifted timing enough to expose the same call-count anti-pattern in useLists (6 failures in 32 runs), which is fixed here too (0 in 48).

Closes DEX-241

Documentation updates

  • docs/testing.md: replaced the "npm test needs --forceExit" bullet, now obsolete, with "don't add it back" and where the gc timers are handled.

Test plan

  • npm test run 25 times in a row: no failures, no torn-down / worker-exit / act() output, and Jest exits on its own
  • --detectOpenHandles reports nothing
  • npm run typecheck, npm run lint, npm run format:check pass
  • CI green
  • Habit rings still animate fill and completion on device

@supabase

supabase Bot commented Oct 20, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project isreileykodwkyedcewv because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@netlify

netlify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for dexterplanner canceled.

Name Link
🔨 Latest commit 997e348
🔍 Latest deploy log https://app.netlify.com/projects/dexterplanner/deploys/6ad7a6657eb5f011a2c4d7c4

@cvburgess
cvburgess merged commit 39f7f7b into main Oct 20, 2026
6 checks passed
@cvburgess
cvburgess deleted the dex-241-fix-fe-test-teardown-leak-and-flaky-usenotes-act-failure branch October 20, 2026 17:35
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.

1 participant