`expo-image` x `jest` Cannot find native module 'ExpoImage'

I successfully updated my app to expo SDK 48
it’s working on production :raised_hands:

but now many of my jest test are failling

  ● Test suite failed to run

    Cannot find native module 'ExpoImage'

      1 | import React from "react";
      2 | import type { ImageProps, ImageStyle } from "expo-image";
    > 3 | import { Image as ExpoImage } from "expo-image";

How can I fix the error message Cannot find native module 'ExpoImage'?

I tried to

// jest.setup.js

jest.mock("expo-image");

but it’s not working :cry:

fixed with

yarn add --dev jest-expo@latest
3 Likes

This solution works for Expo 47 as well. After adding expo-image to my project, my tests would fail with the same error. After updating to latest, all is well. I’m a little concerned that my jest-expo version is now on 48.0.2 while my Expo is on 47.0.1, but my tests are passing again.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.