expo / expo

An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
https://docs.expo.dev
MIT License
29.62k stars 4.7k forks source link

[SDK 50] jest-expo is not mocking expo-localization #27496

Open farhadatifc opened 2 months ago

farhadatifc commented 2 months ago

Minimal reproducible example

https://github.com/centdix/expo-mre

What platform(s) does this occur on?

Android, iOS

Did you reproduce this issue in a development build?

Yes

Summary

Expected: Following this tutorial should work for implementing jest, even if the project uses various expo modules.

What's happening: Trying to add jest test suites to an Expo SDK50 project fails when using expo-localization. Seems like it is not correctly mocked, because trying to access Localization.getLocales()[0].languageCode throws an error.

Environment

expo-env-info 1.2.0 environment info: System: OS: macOS 14.3.1 Shell: 5.9 - /bin/zsh Binaries: Node: 19.1.0 - ~/.nvm/versions/node/v19.1.0/bin/node npm: 8.19.3 - ~/.nvm/versions/node/v19.1.0/bin/npm Managers: CocoaPods: 1.15.0 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4 Android SDK: API Levels: 29, 33 Build Tools: 30.0.3, 33.0.2 System Images: android-29 | Google APIs ARM 64 v8a, android-33 | Google APIs ARM 64 v8a IDEs: Android Studio: 2022.2 AI-222.4459.24.2221.10121639 Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild npmPackages: expo: ~50.0.11 => 50.0.11 react: 18.2.0 => 18.2.0 react-native: 0.73.4 => 0.73.4 npmGlobalPackages: eas-cli: 7.2.0 Expo Workflow: managed

Expo Doctor Diagnostics

✔ Check Expo config for common issues ✔ Check package.json for common issues ✔ Check native tooling versions ✔ Check dependencies for packages that should not be installed directly ✔ Check for common project setup issues ✔ Check npm/ yarn versions ✔ Check for issues with metro config ✔ Check Expo config (app.json/ app.config.js) schema ✔ Check for legacy global CLI installed locally ✔ Check that native modules do not use incompatible support packages ✔ Check that packages match versions required by installed Expo SDK ✔ Check that native modules use compatible support package versions for installed Expo SDK

Didn't find any issues with the project!

expo-bot commented 1 week ago

Thank you for filing this issue! This comment acknowledges we believe this may be a bug and there’s enough information to investigate it. However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.