Files
react-native/packages
Moti Zilberman 7b00a92a3b Add CDP-JSI integration tests (#43027)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43027

Changelog: [Internal]

Adds a test suite for the integration between the modern RN CDP backend and Hermes (plus potentially other JS engines), mocking out the rest of RN.

For simplicity, everything is single-threaded and "async" work is actually done through a queued immediate executor ( = run immediately and finish all queued sub-tasks before returning).

The main limitation of the simpler threading model is that we can't cover breakpoints etc - since pausing during JS execution would prevent the test from making progress. Such functionality is better suited for a full RN+CDP integration test (using RN's own thread management) as well as for each engine's unit tests.

## Types of tests in this diff

* `TEST_F(JsiIntegrationHermesTest, ...)` - tests specific to the Hermes integration.
* `TYPED_TEST(JsiIntegrationPortableTest, ...)` - tests that should pass on all engines.
  * These use gtest's [typed tests](https://google.github.io/googletest/advanced.html#typed-tests) feature.
  * This is a good fit for testing CDP features that have no strict dependency on Hermes (like the upcoming `Runtime.addBinding` support). **Long term**, aspirationally, all tests should be in this category, covering a consistent baseline of CDP features needed for debugging with any supported engine.
  * The first "non-Hermes" engine we test against (`GenericEngineAdapter`) is actually Hermes in disguise, minus any Hermes-specific CDP handling. We could conceivably add more engines here, as long as we have the ability to build them (and their JSI bindings) as part of building the tests.

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D53756996

fbshipit-source-id: fbafb088abd4263ec841bf848185637ec126c6d1
2024-02-14 10:44:41 -08:00
..