react-native-google-signin / google-signin

Google Sign-in for your React Native applications
https://react-native-google-signin.github.io/
MIT License
3.12k stars 877 forks source link

Mock not working in 12.1.0 #1293

Closed gcottrell1 closed 1 month ago

gcottrell1 commented 1 month ago

After updating to 12.1.0, the mock is causing an error when running my tests

Cannot find module '../src/types' from 'node_modules/@react-native-google-signin/google-signin/jest/build/setup.js'

Here is what the module looks like when installed

image

inside jest/build/setup.ts image

Repository with code that reproduces the issue

Expected Behavior

mock works

Actual Behavior

mock doesn't work

Environment

Please provide

devartwa commented 1 month ago

I'm having the same issue, but it seems so simple to fix. I've tried to put "../../src/types" and it worked.

gcottrell1 commented 1 month ago

@devartwa yes its simple enough to patch a fix but thats just a band-aid. The distribution should be fixed properly as any other future imports would face the same issue

devartwa commented 1 month ago

@devartwa yes its simple enough to patch a fix but thats just a band-aid. The distribution should be fixed properly as any other future imports would face the same issue

Sure, I agree! I've cloned the app and tried to run tsc inside the jest folder and it worked like a charm, something happened whey they built and released this version, for sure.

devartwa commented 1 month ago

@vonovak could you please have a look on this?

vonovak commented 1 month ago

Hello, I'll take a look today

devartwa commented 1 month ago

Hello, I'll take a look today

thank you so much!

github-actions[bot] commented 1 month ago

:tada: This issue has been resolved in version 12.1.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

devartwa commented 1 month ago

@vonovak I know it's a dumb question, but have you tested before the release? I've updated the library and got the same error.

Screenshot 2024-05-31 at 10 22 53 am

library version:

Screenshot 2024-05-31 at 10 23 49 am
vonovak commented 1 month ago

Hello, apologies! The correct location of the mock is @react-native-google-signin/google-signin/jest/build/jest/setup.js

I will update the release notes with this breaking change

devartwa commented 1 month ago

Hello, apologies! The correct location of the mock is @react-native-google-signin/google-signin/jest/build/jest/setup.js

I will update the release notes with this breaking change

thank you so much again!