Skip to content

Issue configuring test with Jest and RN 0.76.3 #4605

@jloracudris

Description

@jloracudris

Current behaviour

Im trying to configure unit test with Jest but the tests are complaining that they dont understand React Native paper elements, so i figured that i had to mock all the components, but trying to create the actual mock has not work as expected. im getting this error

Image

if i remove const originalModule = jest.requireActual("react-native-paper"); and mock them manually they work

Im having a weird error on this file (node_modules/react-native/src/private/animated/NativeAnimatedHelper.js:100:38) and im really lost here tbh

Expected behaviour

being able to configure tests

How to reproduce?

try to mock react native paper in a jest.setup.js file like this

Image

Preview

What have you tried so far?

Your Environment

software version
ios x (doesnt matter)
android x (doesnt matter)
react-native 0.76.3
react-native-paper 5.12.5
node 18.19.1
npm or yarn 10.2.4 (npm)
expo sdk x.x.x (CLI app)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions