Skip to main content

All Questions

0 votes
0 answers
38 views

WatermelonDB's withObservables leaking when using with Jest

I'm encountering an issue with Jest while running tests for a React Native component called AccountList. This is a "enhanced" component that uses WatermelonDB's withObservables to keep track ...
Original BBQ Sauce's user avatar
0 votes
0 answers
15 views

React Native Expo Jest Tests: No ".then()" statements are entered in loading in data tests

I am writing feature specs for my application. The application is a music player app, and the user can edit their playlists. The feature in question I am testing edits a track, or all the tracks, in ...
fiocotti's user avatar
1 vote
0 answers
69 views

How to create a unit test for React-Native-Signature-Canvas or mock a method

I wrote a unit test on react-native-signature-canvas, of which only 4/5 succeeded. My last test case "calls readSignatureMock when the TouchableOpacity button is pressed" is failing because ...
user avatar
2 votes
0 answers
90 views

ReferenceError: expect is not defined ( react-native , @testing-library/react-native )

I have been facing two issues mainly console.error Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but ...
Shoyeb Memon's user avatar
  • 1,159
0 votes
0 answers
82 views

How to handle react component being unmounted on user press in unit testing

I am writing Jest tests for my react native application. When I use user.press function, I get the following error: Unable to find node on an unmounted component. at findCurrentFiberUsingSlowPath (...
Nowhereman's user avatar
1 vote
1 answer
427 views

Jest: Cannot read properties of undefined (reading 'getItem') when trying to mock Async Storage

I am struggling getting my jest spec to work with AsyncStorage. I followed the guide on Jest integration with Async Storage and used the guidance for setting up the mocks directory. This makes my ...
fiocotti's user avatar
13 votes
1 answer
5k views

Jest tests started failing with TypeError: A dynamic import callback was invoked without --experimental-vm-modules after recent React Native upgrade

I've been trying to resolve this test error for a while now with not success. Recently I upgraded React Native from 0.72.3 to 0.74.3 and got the Android application to build and run, however, I can't ...
Onyx's user avatar
  • 5,780
-1 votes
1 answer
253 views

Getting error in Component testing - Jest & react-native testing library

Getting error when using the render method to test component `Trying to detect host component names triggered the following error: Unexpected token 'export' There seems to be an issue with your ...
Prajwal VK's user avatar
0 votes
0 answers
43 views

Issue while writing Unit Test case with jest for testing a function depends on AuthContext state

I am getting an issue "TypeError: Cannot read properties of undefined (reading '_context')Jest" while writing Unit Test Case with jest in my react native project with java script. I have ...
anushka sain's user avatar
0 votes
0 answers
62 views

__DEV__ not defined for React Native Jest in React + React Native monorepo

I have a monorepo with a React project and a React Native project, they both run fine but the jest tests do not work on React Native tests I'm getting the error: FAIL packages/app/components/index....
TheKian's user avatar
  • 39
0 votes
3 answers
2k views

TypeError: Cannot assign to read only property 'fetch' of object '[object global]'

I've encountered an error with my tests from a mysterious way. Context : I have a lot of testing files that work for everyone expect me. In the only test that fail, the only issue is this line : const ...
Exiosys's user avatar
0 votes
1 answer
147 views

Testing in React Native with ts: Cannot use import statement outside a module

When running my test using Jest in my React-Native project with typescript, I cant manage to get rid of this import error: SyntaxError: Cannot use import statement outside a module I only have a ...
Angel Rafael's user avatar
2 votes
0 answers
829 views

Invariant Violation: __fbBatchedBridgeConfig is not set, cannot invoke native modules

I am getting he following error when running a jest test: ● Test suite failed to run Invariant Violation: __fbBatchedBridgeConfig is not set, cannot invoke native modules 1 | import { Platform } ...
Hardik3296's user avatar
0 votes
1 answer
8k views

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components)... with correct import/export

Error I'm trying to render a component in jest and getting the following Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: ...
siberowl's user avatar
0 votes
1 answer
514 views

React Navigation is not navigating to the screen when testing with React Native Testing Library and Jest

I have configured everything as described in the React Native Testing Library guide. Test case description - I load the home screen, tap on a list item in the home screen which navigates to the movie ...
Shubham Hande's user avatar

15 30 50 per page
1
2 3 4 5
30