react-native-google-signin/google-signin

Mock not working in 12.1.0

Closed this issue · 10 comments

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

  • You must provide a minimal and easy-to-run reproduction of your issue - how to create a minimal reproduction?. We're a small team of maintainers and do not have time to try reproduce bugs ourselves.

  • Please try to reproduce the bugs on the provided example app. Either provide a link to the repo that reproduces the bug or provide your version of the index.js file that reproduces the issue and that we can easily use.

  • Explain the steps we need to take to reproduce the issue.

  • Include a gif if you think it may help.

  • If you're asking for help, please make it easy for us to help you!

Expected Behavior

mock works

Actual Behavior

mock doesn't work

Environment

Please provide

  • react-native version 0.73.8
  • @react-native-google-signin/google-signin version 12.1.0
  • your Podfile, output of running pod install and cocoapods version (if applicable)
  • version of Android, gradle, android plugin for gradle, play-services-auth and version of the Google Play Services app on your phone (if applicable)
  • version of iOS (if applicable)

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

@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 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.

@vonovak could you please have a look on this?

Hello, I'll take a look today

Hello, I'll take a look today

thank you so much!

🎉 This issue has been resolved in version 12.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@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

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

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!