Skip to content

Fix flaky Modal-itest by adding proper root cleanup#55712

Closed
sammy-SC wants to merge 1 commit intofacebook:mainfrom
sammy-SC:export-D92171933
Closed

Fix flaky Modal-itest by adding proper root cleanup#55712
sammy-SC wants to merge 1 commit intofacebook:mainfrom
sammy-SC:export-D92171933

Conversation

@sammy-SC
Copy link
Contributor

Summary:
changelog: [internal]

The Modal tests are flaky because message queue is sometimes not empty, leading to error: "MessageQueue is not empty".

The fix adds beforeEach/afterEach hooks to create a fresh root for each test and properly destroy it afterwards. The root.destroy() call flushes the message queue, ensuring cleanup happens before the next test.

I am not 100% sure why this happens, especially in multithreading environment. But this makes the situation less bad and tests less flaky. It does not address the root cause.

Reviewed By: cipolleschi

Differential Revision: D92171933

@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 24, 2026
@meta-codesync
Copy link

meta-codesync bot commented Feb 24, 2026

@sammy-SC has exported this pull request. If you are a Meta employee, you can view the originating Diff in D92171933.

Summary:

changelog: [Internal]

The Modal tests are flaky because message queue is sometimes not empty, leading to error: "MessageQueue is not empty".

The fix adds beforeEach/afterEach hooks to create a fresh root for each test and properly destroy it afterwards. The root.destroy() call flushes the message queue, ensuring cleanup happens before the next test. 

I am not 100% sure why this happens, especially in multithreading environment. But this makes the situation less bad and tests less flaky. It does not address the root cause.

Reviewed By: cipolleschi

Differential Revision: D92171933
@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @sammy-SC in bd4eee2

When will my fix make it into a release? | How to file a pick request?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Feb 24, 2026
@meta-codesync
Copy link

meta-codesync bot commented Feb 24, 2026

This pull request has been merged in bd4eee2.

cortinico pushed a commit that referenced this pull request Feb 27, 2026
Summary:
Pull Request resolved: #55712

changelog: [Internal]

The Modal tests are flaky because message queue is sometimes not empty, leading to error: "MessageQueue is not empty".

The fix adds beforeEach/afterEach hooks to create a fresh root for each test and properly destroy it afterwards. The root.destroy() call flushes the message queue, ensuring cleanup happens before the next test.

I am not 100% sure why this happens, especially in multithreading environment. But this makes the situation less bad and tests less flaky. It does not address the root cause.

Reviewed By: cipolleschi

Differential Revision: D92171933

fbshipit-source-id: 0b931771475c9b65fe287ab06d1652d7d5d7efab
zoontek pushed a commit to zoontek/react-native that referenced this pull request Mar 9, 2026
Summary:
Pull Request resolved: facebook#55712

changelog: [Internal]

The Modal tests are flaky because message queue is sometimes not empty, leading to error: "MessageQueue is not empty".

The fix adds beforeEach/afterEach hooks to create a fresh root for each test and properly destroy it afterwards. The root.destroy() call flushes the message queue, ensuring cleanup happens before the next test.

I am not 100% sure why this happens, especially in multithreading environment. But this makes the situation less bad and tests less flaky. It does not address the root cause.

Reviewed By: cipolleschi

Differential Revision: D92171933

fbshipit-source-id: 0b931771475c9b65fe287ab06d1652d7d5d7efab
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. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants