Skip to content

LogBoxData test migrated to Jest modern timers#55757

Open
chicio wants to merge 2 commits intofacebook:mainfrom
chicio:logboxdata_jest_timers
Open

LogBoxData test migrated to Jest modern timers#55757
chicio wants to merge 2 commits intofacebook:mainfrom
chicio:logboxdata_jest_timers

Conversation

@chicio
Copy link
Contributor

@chicio chicio commented Feb 25, 2026

Summary:

This PR migrates the LogBoxData tests so that it uses Jest modern timers.
I removed the legacyFakeTimers property from useFakeTimers (like I did in the previous PR for Pressability tests #55410), and moved it to a beforeEach. This in combination with restoring real timers in afterEach improves tests reliability and isolation.
Then I modified some tests that started to fail by adding explicit flushToObservers().
The extra flushToObservers() calls are necessary because addLog/addException schedule processing using setImmediate, and inside that callback handleUpdate() schedules observer notifications using another setImmediate (so we need to flush twice to simulate the correct behaviour like it was already done in some other tests in the test suite).

Changelog:

[GENERAL] [CHANGED] - Migrated LogBoxData tests to Jest modern timers

Test Plan:

  • Ran LogBoxData-test and verify all tests cases passed
  • Ran the React Native test suite to ensure all tests pass
  • Verified test correctness by intentionally breaking production code after fixing the tests (eg. removing the handleUpdate call in addException, that changes the call to the observer)

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 25, 2026
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants