Jest test fails when trying to mock reanimated
See original GitHub issueI mock reanimated in my snapshot test as described in the documentation:
jest.mock("react-native-reanimated", () => require("react-native-reanimated/mock"))
But my test fails with the following error:
/[...]/node_modules/react-native-reanimated/mock.js:30
" __value": number;
^
SyntaxError: Unexpected token :
What am I doing wrong?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
jest will fail with react-native-reanimated · Issue #1589 - GitHub
I created a react-native-library with react-native-reanimated . Now I'm trying to add tests to my project, but all the tests fail.
Read more >"TypeError" when trying to render react-native-reanimated ...
The problem is with with react-native-reanimated. Follow the procedure as in react-native-reanimated documentation. It should work fine now. If ...
Read more >Testing with Jest | React Native Reanimated - Software Mansion
Reanimated test mocks use web implementation of Reanimated2. Before you begin using Reanimated mocks you need some setup actions.
Read more >Testing with Jest - React Navigation
Testing code using React Navigation may require some setup since we need to ... and the NativeAnimatedHelper section for mocking react-native-reanimated
Read more >React Navigation | React Native Testing Library - Open Source
Make sure that the path to the file in setupFiles is correct. Jest will run these files before running your tests, so it's...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This happens because there are TS annotations in
.js
file. I created #613 which should fix thatIt should be released on 1.7.1, try checking that