From 7131e36dd506692cb5e36cbca5d2238e762ada8a Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 23 Oct 2026 17:24:40 -0700 Subject: [PATCH 1/6] Bridgeless-context FabricUIManagerPullModelTest (#59271) Summary: Migrate `FabricUIManagerPullModelTest` from the deprecated `createCatalystContextForTest` helper to `createTestReactApplicationContext`, so the test builds a bridgeless context directly. Changelog: [Internal] Differential Revision: D126574347 --- .../com/facebook/react/fabric/FabricUIManagerPullModelTest.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/FabricUIManagerPullModelTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/FabricUIManagerPullModelTest.kt index e0796289dfc3..ee4ae40079e6 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/FabricUIManagerPullModelTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/FabricUIManagerPullModelTest.kt @@ -39,6 +39,7 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.mock import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment import org.robolectric.Shadows.shadowOf import org.robolectric.annotation.Config import org.robolectric.shadow.api.Shadow @@ -76,7 +77,8 @@ class FabricUIManagerPullModelTest { fun setup() { ReactNativeFeatureFlagsForTests.setUp() overrideFeatureFlags() - reactContext = ReactTestHelper.createCatalystContextForTest() + reactContext = + ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) underTest = FabricUIManager( reactContext, From 9867031489d53d4b4f5b589bdbcf033c1f347aae Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 23 Oct 2026 17:24:40 -0700 Subject: [PATCH 2/6] Bridgeless-context MountingManagerAnimatedPropsTest (#59272) Summary: Migrate `MountingManagerAnimatedPropsTest` from the deprecated `createCatalystContextForTest` helper to `createTestReactApplicationContext`, so the test builds a bridgeless context directly. Changelog: [Internal] Differential Revision: D126574351 --- .../facebook/react/fabric/MountingManagerAnimatedPropsTest.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/MountingManagerAnimatedPropsTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/MountingManagerAnimatedPropsTest.kt index f9f4f59e5795..4a3f6f936d3c 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/MountingManagerAnimatedPropsTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/MountingManagerAnimatedPropsTest.kt @@ -31,6 +31,7 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment import org.robolectric.annotation.Config @RunWith(RobolectricTestRunner::class) @@ -54,7 +55,8 @@ class MountingManagerAnimatedPropsTest { @Before fun setUp() { ReactNativeFeatureFlagsForTests.setUp() - val reactContext = ReactTestHelper.createCatalystContextForTest() + val reactContext = + ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) themedReactContext = ThemedReactContext(reactContext, reactContext, null, -1) mountingManager = MountingManager(ViewManagerRegistry(listOf>(ReactViewManager())), {}) From e62b94944d908babc4b1d499513fe2f4fe54e90e Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 23 Oct 2026 17:24:40 -0700 Subject: [PATCH 3/6] Bridgeless-context SurfaceMountingManagerSynchronousMountPropsTest (#59273) Summary: Migrate `SurfaceMountingManagerSynchronousMountPropsTest` from the deprecated `createCatalystContextForTest` helper to `createTestReactApplicationContext`, so the test builds a bridgeless context directly. Changelog: [Internal] Differential Revision: D126574353 --- .../fabric/SurfaceMountingManagerSynchronousMountPropsTest.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerSynchronousMountPropsTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerSynchronousMountPropsTest.kt index 884078cdc72c..1e7e51deb722 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerSynchronousMountPropsTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerSynchronousMountPropsTest.kt @@ -34,6 +34,7 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment import org.robolectric.annotation.Config /** @@ -65,7 +66,8 @@ class SurfaceMountingManagerSynchronousMountPropsTest { @Before fun setUp() { ReactNativeFeatureFlagsForTests.setUp() - val reactContext = ReactTestHelper.createCatalystContextForTest() + val reactContext = + ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) themedReactContext = ThemedReactContext(reactContext, reactContext, null, -1) mountingManager = MountingManager( From 90380f1ca22c332e4a7b05eae8c81d1d60668353 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 23 Oct 2026 17:24:40 -0700 Subject: [PATCH 4/6] Bridgeless-context SurfaceMountingManagerTest (#59274) Summary: Migrate `SurfaceMountingManagerTest` from the deprecated `createCatalystContextForTest` helper to `createTestReactApplicationContext`, so the test builds a bridgeless context directly. Add the `ShadowSoLoader` Robolectric shadow, which the new helper needs to mock the component factory. Changelog: [Internal] Differential Revision: D126574354 --- .../facebook/react/fabric/SurfaceMountingManagerTest.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerTest.kt index f7372288b68f..a1282668eb23 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerTest.kt @@ -20,11 +20,14 @@ import com.facebook.react.uimanager.ThemedReactContext import com.facebook.react.uimanager.ViewManager import com.facebook.react.uimanager.ViewManagerRegistry import com.facebook.react.views.view.ReactViewManager +import com.facebook.testutils.shadows.ShadowSoLoader import org.assertj.core.api.Assertions.assertThat import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment +import org.robolectric.annotation.Config /** * Tests for [SurfaceMountingManager] view lifecycle around preallocateView, deleteView, and @@ -42,6 +45,7 @@ import org.robolectric.RobolectricTestRunner * See T223288217. */ @RunWith(RobolectricTestRunner::class) +@Config(shadows = [ShadowSoLoader::class]) class SurfaceMountingManagerTest { private lateinit var mountingManager: MountingManager private lateinit var themedReactContext: ThemedReactContext @@ -50,7 +54,8 @@ class SurfaceMountingManagerTest { @Before fun setUp() { ReactNativeFeatureFlagsForTests.setUp() - val reactContext = ReactTestHelper.createCatalystContextForTest() + val reactContext = + ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) themedReactContext = ThemedReactContext(reactContext, reactContext, null, -1) mountingManager = MountingManager( From 821c0dfae3dfcbeedddcbf29ec59a77fbb27268c Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 23 Oct 2026 17:24:40 -0700 Subject: [PATCH 5/6] Bridgeless-context BaseViewManagerDelegateTest (#59275) Summary: Migrate `BaseViewManagerDelegateTest` from the deprecated `createCatalystContextForTest` helper to `createTestReactApplicationContext`, so the test builds a bridgeless context directly. Add the `ShadowSoLoader` Robolectric shadow, which the new helper needs to mock the component factory. Changelog: [Internal] Differential Revision: D126574355 --- .../react/uimanager/BaseViewManagerDelegateTest.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerDelegateTest.java b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerDelegateTest.java index 13ad5c6a95c3..329f88e2fee8 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerDelegateTest.java +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerDelegateTest.java @@ -16,13 +16,17 @@ import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsForTests; import com.facebook.react.views.view.ReactViewGroup; import com.facebook.react.views.view.ReactViewManager; +import com.facebook.testutils.shadows.ShadowSoLoader; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; +import org.robolectric.RuntimeEnvironment; +import org.robolectric.annotation.Config; @RunWith(RobolectricTestRunner.class) +@Config(shadows = ShadowSoLoader.class) public class BaseViewManagerDelegateTest { private ReactViewManager viewManager; private ReactViewGroup view; @@ -34,7 +38,9 @@ public void setUp() { // (non-JNI) accessor so Robolectric doesn't try to load react_featureflagsjni. ReactNativeFeatureFlagsForTests.INSTANCE.setUp(); viewManager = mock(ReactViewManager.class); - ReactApplicationContext context = ReactTestHelper.createCatalystContextForTest(); + ReactApplicationContext context = + ReactTestHelper.INSTANCE.createTestReactApplicationContext( + RuntimeEnvironment.getApplication()); ThemedReactContext themedReactContext = new ThemedReactContext(context, context, null, -1); view = new ReactViewGroup(themedReactContext); delegate = new BaseViewManagerDelegate<>(viewManager) {}; From c3643ae5c0c96086b1a83348063ec80cea8be92c Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 23 Oct 2026 17:24:40 -0700 Subject: [PATCH 6/6] Bridgeless-context ImageLoaderModuleTest (#59278) Summary: Migrate `ImageLoaderModuleTest` from the deprecated `createCatalystContextForTest` helper to `createTestReactApplicationContext`, so the test builds a bridgeless context directly. Stub the feature flags before context creation, since the bridgeless context reads them during init. Changelog: [Internal] Differential Revision: D126574356 --- .../facebook/react/modules/image/ImageLoaderModuleTest.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/image/ImageLoaderModuleTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/image/ImageLoaderModuleTest.kt index 45f1f7f59b69..f12159fe9e57 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/image/ImageLoaderModuleTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/image/ImageLoaderModuleTest.kt @@ -25,6 +25,7 @@ import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.bridge.ReactTestHelper import com.facebook.react.bridge.ReadableMap import com.facebook.react.bridge.WritableMap +import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsForTests import com.facebook.react.views.image.ReactCallerContextFactory import com.facebook.react.views.imagehelper.ResourceDrawableIdHelper import com.facebook.testutils.shadows.ShadowArguments @@ -45,6 +46,7 @@ import org.mockito.kotlin.never import org.mockito.kotlin.verify import org.mockito.kotlin.whenever import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment import org.robolectric.annotation.Config /** The payload is never decoded — every test here mocks the image pipeline. */ @@ -60,7 +62,9 @@ class ImageLoaderModuleTest { @Before fun setUp() { - reactContext = ReactTestHelper.createCatalystContextForTest() + ReactNativeFeatureFlagsForTests.setUp() + reactContext = + ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) imageLoaderModule = ImageLoaderModule(reactContext) mockedHelper = mockStatic(ResourceDrawableIdHelper::class.java)