georstat/react-native-image-cache

● Test suite failed to run Invariant Violation: `new NativeEventEmitter()` requires a non-null argument.

Sahand-Stefan opened this issue · 4 comments

I am facing issue in this dependency while running tests with jest

● Test suite failed to run

Invariant Violation: `new NativeEventEmitter()` requires a non-null argument.

  1 | import React from "react"
  2 | import { Image, ImageStyle, ImageResizeMode, ImageBackground } from "react-native"
> 3 | import { CachedImage } from "@georstat/react-native-image-cache"
    | ^
  4 | import { EnumImageType } from "@app/constants"
  5 |
  6 | interface LActImageProps {

Hi @Sahand-Stefan, it seems the issue comes from react-native-file-access, it's using NativeEventEmitter as seen here

Please open an issue on that repo and reference this issue here.

@efstathiosntonas

Yes Thanks, I mocked it like this and is working now:

jest.mock("@georstat/react-native-image-cache", () => ({ source: "", CacheManager: { config: {}, }, }))

Great, glad you found a solution!