From a6cadd58638359fa8f68adf61bdb1f61c324dd82 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Mon, 21 Aug 2023 03:16:38 -0700 Subject: [PATCH] Cleanup BUCK setup for our JVM tests (#39061) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39061 We're suppressing JVM tests using BUCK which is causing misalignment between which tests we run on Buck vs Gradle. Instead we should be using the Ignore annotation (which we already do) to decide which tests to skip, so that Buck can just pick all the Java/Kotlin file in this folder. Changelog: [Internal] [Changed] - Cleanup BUCK setup for our JVM tests Reviewed By: cipolleschi Differential Revision: D48433432 fbshipit-source-id: c919d4988f424584d75160c67667352e48cce051 --- .../react/fabric/interop/InteropEventEmitterTest.kt | 3 ++- .../facebook/react/uimanager/ReactPropConstantsTest.kt | 8 +++----- .../interop => testutils/fakes}/FakeEventDispatcher.kt | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) rename packages/react-native/ReactAndroid/src/test/java/com/facebook/{react/fabric/interop => testutils/fakes}/FakeEventDispatcher.kt (97%) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/interop/InteropEventEmitterTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/interop/InteropEventEmitterTest.kt index 7922e5301d6c84..f4348f8d43186f 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/interop/InteropEventEmitterTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/interop/InteropEventEmitterTest.kt @@ -10,6 +10,7 @@ package com.facebook.react.fabric.interop import com.facebook.react.bridge.JavaOnlyMap import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.bridge.ReactContext +import com.facebook.testutils.fakes.FakeEventDispatcher import org.junit.Assert.assertEquals import org.junit.Assert.assertNotNull import org.junit.Before @@ -21,7 +22,7 @@ import org.robolectric.RuntimeEnvironment @RunWith(RobolectricTestRunner::class) class InteropEventEmitterTest { lateinit var reactContext: ReactContext - lateinit var eventDispatcher: FakeEventDispatcher + private lateinit var eventDispatcher: FakeEventDispatcher @Before fun setup() { diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropConstantsTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropConstantsTest.kt index 763ee404af3d27..216cd769f11ba5 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropConstantsTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropConstantsTest.kt @@ -30,13 +30,11 @@ class ReactPropConstantsTest { } override fun createShadowNodeInstance(): ReactShadowNode<*>? { - Assertions.fail("This method should not be executed as a part of this test") - return null + error("This method should not be executed as a part of this test") } override fun createViewInstance(reactContext: ThemedReactContext): View { - Assertions.fail("This method should not be executed as a part of this test") - return View(reactContext) + error("This method should not be executed as a part of this test") } override fun getShadowNodeClass(): Class> { @@ -44,7 +42,7 @@ class ReactPropConstantsTest { } override fun updateExtraData(root: View, extraData: Any) { - Assertions.fail("This method should not be executed as a part of this test") + error("This method should not be executed as a part of this test") } @ReactProp(name = "boolProp") fun setBoolProp(v: View?, value: Boolean) {} diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/interop/FakeEventDispatcher.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/testutils/fakes/FakeEventDispatcher.kt similarity index 97% rename from packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/interop/FakeEventDispatcher.kt rename to packages/react-native/ReactAndroid/src/test/java/com/facebook/testutils/fakes/FakeEventDispatcher.kt index 3c444a5d124756..b645d6930c25bc 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/interop/FakeEventDispatcher.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/testutils/fakes/FakeEventDispatcher.kt @@ -6,7 +6,7 @@ */ @file:Suppress("DEPRECATION") // Suppressing as RCTEventEmitter is part of the API -package com.facebook.react.fabric.interop +package com.facebook.testutils.fakes import com.facebook.react.uimanager.events.BatchEventDispatchedListener import com.facebook.react.uimanager.events.Event