New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading a font using expo-font
fails in jest
unit tests: Module is missing from the asset registry
#21434
Comments
confirmed to reproduce the issue even using sdk 48 compatible expo-asset@8.9.0. |
Thank you for filing this issue! |
Same issue on expo@48.0.0, expo-asset@8.9.0 Adding the following to
|
It works for me! |
Hmm, what if you're getting this error outside of Jest? |
Same error outside of jest in the Expo Go after SDK 45 -> 48 upgrade. |
expo return array, u can mock like this jest.mock('expo-font', () => []); |
I was also experiencing this issue from |
What is "setupJests" ? I don't see any file with this name |
You can configure setupFiles on jest, something like
|
Minimal reproducible example
https://github.com/coffeebeats/example-expo-asset-registry-bug
Summary
After upgrading from
expo-asset@8.7.0
toexpo-asset@8.8.0
, when trying to load a font viaexpo-font
in ajest
unit test, the font asset module is found to be missing from thereact-native
asset registry. The error is provided below, with the path to the example repository replaced with<rootDir>
:I think the commit that introduced this is #20258, but I haven't yet been able to trace down why this is occurring or how the font module actually gets into the registry successfully in
expo-asset@8.7.0
(assuming that the issue isn't related to a missing mock, or something like that).A few other points:
Environment
expo-env-info 1.0.5 environment info:
System:
OS: macOS 13.2.1
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.14.1 - ~/.volta/tools/image/node/18.14.1/bin/node
Yarn: 3.3.0 - ~/.volta/tools/image/yarn/3.3.0/bin/yarn
npm: 9.3.1 - ~/.volta/tools/image/node/18.14.1/bin/npm
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK:
API Levels: 33
Build Tools: 30.0.3, 33.0.2
System Images: android-30 | AOSP ATD ARM 64 v8a, android-33 | Google APIs ARM 64 v8a
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9514443
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
npmPackages:
expo: 48.0.4 => 48.0.4
react: 18.2.0 => 18.2.0
react-native: 0.71.3 => 0.71.3
Expo Workflow: managed
The text was updated successfully, but these errors were encountered: