braze-inc / braze-react-native-sdk

Public repo for the Braze React Native SDK
https://www.braze.com
Other
64 stars 84 forks source link

[Bug]: Jest issue #244

Closed atrofimenko closed 9 months ago

atrofimenko commented 9 months ago

Which Platforms?

Both

Which React Native Version?

0.70.5

Which @braze/react-native-sdk SDK version?

8.2.0

Repro Rate

100%

Steps To Reproduce

Example:

  1. import Braze from "@braze/react-native-sdk".
  2. Run jest tests update

Expected Behavior

No errors

Actual Incorrect Behavior

Getting this error when trying to run tests Screenshot 2024-02-06 at 18 02 37 After some manipulations with jest config, like: "transformIgnorePatterns": [ "node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.|@expo-google-fonts/.|react-navigation|@react-navigation/.|@unimodules/.|unimodules|sentry-expo|native-base|react-native-svg|@rneui/.|@gorhom/.|@braze/react-native-sdk)" ], Getting this error: Screenshot 2024-02-06 at 17 58 40 Any thoughts how to fix this?) Thank you.

Verbose Logs

No response

Additional Information

No response

jerielng commented 9 months ago

Hey @atrofimenko, are you upgrading from a previous version of the Braze SDK? We made some internal changes in version 6.0.0 to support the React Native New Architecture. It looks like you may need to update how you import the Braze module. You can refer to our sample test setup here.

atrofimenko commented 9 months ago

Hey @atrofimenko, are you upgrading from a previous version of the Braze SDK? We made some internal changes in version 6.0.0 to support the React Native New Architecture. It looks like you may need to update how you import the Braze module. You can refer to our sample test setup here.

@jerielng Thank you! Copied all the content of the file tests/jest.setup.js to my setup and it did not help me

atrofimenko commented 9 months ago

Hey @atrofimenko, are you upgrading from a previous version of the Braze SDK? We made some internal changes in version 6.0.0 to support the React Native New Architecture. It looks like you may need to update how you import the Braze module. You can refer to our sample test setup here.

Changed path to NativeBrazeReactModule and added back transformIgnorePatterns - now it works, thank you!

jerielng commented 9 months ago

Awesome, that's great to hear! I'll go ahead and close out this issue, but feel free to open a new one if you have additional questions. Thank you!