☂️ Help us Kotlin-ify React Native tests
Description
Hey all 👋 We're looking for some community support to help us prepare the codebase of React Native Android to be ready to migrate to Kotlin. In this first stage we are looking for help to migrate tests to Kotlin
How to migrate a test
If you wish to convert one of the tests you should:
- Verify that the test is not claimed yet.
- Comment here that you claim a test.
- Start working on adding Kotlin support for the test.
- Make sure your environment is set up correctly (see below)
- Use this PR as inspiration: Convert RootViewTest to Kotlin - #37227
- Make sure the test run correctly (see below).
- Your Kotlin code should be formatted with ktfmt (see below).
- Send the PR for review. Ping @cortinico and @mdvacca for a review.
Setting up your environment
Make sure your environment is set correctly, specifically you need to:
- Fork react-native
- Clone react-native locally
- Run
yarninside your local fork (installation instruction for yarn are here) - Make sure you have Java 11 installed and the Android SDK configured (you can follow our official guide here)
Running your tests
You can run your tests either by using the Android Studio/IntelliJ UI or by invoking the following command in your React Native fork:
./gradlew :packages:react-native:ReactAndroid:test
Code formatting
Please use KtFmt to format Kotlin tests. You can use the web UI to reformat directly from the browser: https://facebook.github.io/ktfmt/
List of tests to migrate
- [x] common/logging/FakeLoggingDelegate.java assigned to @MohamedRejeb
- [x] react/CompositeReactPackageTest.java assigned to @MohamedRejeb
- [x] react/animated/NativeAnimatedInterpolationTest.java assigned to @fabioh8010
- [ ] react/animated/NativeAnimatedNodeTraversalTest.java - Assigned to @ankit-tailor
- [x] react/bridge/FallbackJSBundleLoaderTest.java Assigned to @fabioh8010
- [x] react/bridge/InstanceHandleHelper.java assigned to @arslandogar
- [x] react/bridge/JavaOnlyArrayTest.java assigned to @rozkminiacz
- [ ] react/bridge/JavaScriptModuleRegistryTest.java assigned to @rozkminiacz
- [x] react/bridge/ReactTestHelper.java assigned to @abdennour-jebbar-nw
- [ ] react/bridge/BaseJavaModuleTest.java assigned to @abdennour-jebbar-nw
- [x] react/bridge/interop/FakeRCTEventEmitter.java assigned to @dcangulo
- [x] react/bridge/interop/InteropModuleRegistryTest.java assigned to @dcangulo
- [x] react/devsupport/MultipartStreamReaderTest.java assigned to @brunohensel
- [x] react/devsupport/StackTraceHelperTest.java assigned to @koko57
- [x] react/fabric/events/TouchEventDispatchTest.java assigned to @MohamedRejeb
- [x] react/fabric/interop/FakeEventDispatcher.java assigned to @tarunrajput
- [ ] react/fabric/interop/InteropEventEmitterTest.java assigned to @jasokolowska
- [x] react/modules/blob/BlobModuleTest.java assigned to @mateusz1913
- [x] react/modules/camera/ImageStoreManagerTest.java assigned to @megatunger
- [x] react/modules/clipboard/ClipboardModuleTest.java assigned to @hurali97
- [x] react/modules/deviceinfo/DeviceInfoModuleTest.java assigned to @okwasniewski
- [x] react/modules/dialog/DialogModuleTest.java assigned to @fathonyfath
- [x] react/modules/network/HeaderUtilTest.java assigned to @TheMissouri
- [ ] react/modules/network/ReactCookieJarContainerTest.java assigned to @pk-218
- [x] react/modules/network/ProgressiveStringDecoderTest.java assigned to @RyanGst
- [x] react/modules/share/ShareModuleTest.java assigned to @siddarthkay
- [x] react/packagerconnection/JSPackagerClientTest.java assigned to @brunohensel
- [x] react/uimanager/UIManagerModuleConstantsHelperTest.java assigned to @ryanlntn
- [x] react/uimanager/layoutanimation/InterpolatorTypeTest.java assigned to @Janjs
- [x] react/util/JSStackTraceTest.java assigned to @aymane-missouri-nw
Hey @cortinico, Please assign me react/animated/NativeAnimatedNodeTraversalTest.java.
Hey @cortinico, you can assign me to react/modules/deviceinfo/DeviceInfoModuleTest.java
Hey @cortinico , can you assign me react/modules/clipboard/ClipboardModuleTest.java ?
Hey @cortinico , can you assign me react/fabric/events/TouchEventDispatchTest.java
Hey @cortinico, can you assign me to this one react/animated/NativeAnimatedInterpolationTest.java?
hey @cortinico , can you assign me to this one react/util/JSStackTraceTest.java
Hi @cortinico , you can assign me to react/bridge/JavaOnlyArrayTest.java react/bridge/JavaScriptModuleRegistryTest.java
Hey @cortinico , can you assign me to this one react/modules/network/HeaderUtilTest.java
Hey @cortinico , I'd like to take this one /react/modules/share/ShareModuleTest.java please assign it to me
Hey @cortinico, assign me to react/modules/blob/BlobModuleTest.java
Hi @cortinico, I'd like to work on this one : react/fabric/interop/FakeEventDispatcher.java
Hi @cortinico, can you assign react/modules/network/ReactCookieJarContainerTest.java to me?
Hi @cortinico, can you assign this one to me? react/modules/camera/ImageStoreManagerTest.java
Awesome stuff, I've assigned all the tasks that got claimed so far. Folks that got a test class assigned, can start working on it.
hey @cortinico, can you assign this one to me? react/modules/network/ProgressiveStringDecoderTest.java
hey @cortinico , could you assign me this one react/modules/dialog/DialogModuleTest.java
I'll try to help as much as possible :)
Hey @cortinico, please assign me react/fabric/interop/InteropEventEmitterTest.java
Hi @cortinico, I'd like to pick up this one react/uimanager/layoutanimation/InterpolatorTypeTest.java
Hi @cortinico, Please assign me react/bridge/InstanceHandleHelper.java
Hi @cortinico! Could you please assign react/devsupport/StackTraceHelperTest.java to me? 🙂
Hello @cortinico! please assign react/bridge/ReactTestHelper.java and react/bridge/BaseJavaModuleTest.java me
Hey @cortinico you can assign me to this one react/packagerconnection/JSPackagerClientTest.java And react/devsupport/MultipartStreamReaderTest.java
Hi @cortinico! Please assign react/uimanager/UIManagerModuleConstantsHelperTest.java to me.
Thanks everyone! I've assigned all the tasks that got claimed so far. Folks that got a test class assigned, can start working on it.
Hey @cortinico assign me the remaining ones please. common/logging/FakeLoggingDelegate.java react/CompositeReactPackageTest.java
Hey @cortinico assign me the remaining ones please.
Hey @MohamedRejeb, to give everyone a chance to contribute, we're not allowing more than 2 files per person. I've assigned you FakeLoggingDelegate.java and CompositeReactPackageTest.java
@cortinico Can I get https://github.com/facebook/react-native/tree/main/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/interop/FakeRCTEventEmitter.java?
@cortinico Since you allow at most 2 files and no one else commenting, can I get react/bridge/interop/InteropModuleRegistryTest.java?
Hi @cortinico , can I also get the last one react/bridge/FallbackJSBundleLoaderTest.java? Will start working on the 2 files in a few minutes.