facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.28k stars 24.35k forks source link

introduce ability to flush messege queue from tests #47646

Open sammy-SC opened 18 hours ago

sammy-SC commented 18 hours ago

Summary: changelog: [internal]

In order to control scheduling of tests, test setup must be separated from test running. This is because of how internal scheduling of React Native is restricted until bundle is loaded via BufferedRuntimeExecutor. This is the reason for executing tests by calling global function $$RunTests$$. This is not a pretty solution but it is hidden within testing infrastructure and users of our test infra are not exposed to this.

There is a new method exposed to JavaScript: flushMessageQueue. This will flush everything that is inside of message queue. This is the queue where tasks are queued whenever RuntimeScheduler enqueues something by calling runtimeExecutor_.

Reviewed By: christophpurrer

Differential Revision: D65951894

facebook-github-bot commented 18 hours ago

This pull request was exported from Phabricator. Differential Revision: D65951894

facebook-github-bot commented 9 hours ago

This pull request was exported from Phabricator. Differential Revision: D65951894