Skip to main content

All Questions

Tagged with
0 votes
0 answers
28 views

Testting component with react native paper and expo fonts

I'm having some trouble trying to test my React Native Component with jest. In my components, I have these imports: import { useState } from 'react'; import { View, Text, TextInput, TouchableOpacity, ...
Pau Segura Baños's user avatar
0 votes
0 answers
41 views

Can't mock a lib using jest.mock

So, I'm setting up the unit test environment on my current react native project using jest + @testing-library/react-native. I'm currently mocking some libs we have installed, the one that is giving me ...
Backes's user avatar
  • 41
0 votes
0 answers
35 views

React native with jest Cannot use import statement outside a module

I'm using react native 0.73.0, react 18.2.0, jest 29.6.3, and @testing-library/react-native 12.4.3. When I run command npx jest src/components/ActionButton/__tests__/ActionButton.test.js --...
Kanwarjeet Singh's user avatar
1 vote
0 answers
44 views

SyntaxError: C:\zero\node_modules\react-native\Libraries\Components\Touchable\TouchableOpacity.js: Missing initializer in const declaration

I'm trying to write tests for my React Native app (using TypeScript). All my unit tests pass without issues, but when writing component tests, I encounter the following error: ● ButtonComponent › ...
shirxz's user avatar
  • 11
0 votes
2 answers
67 views

Snapshot Testing - Realm already opened on current thread with different schema

I have made a React Native app which uses the Realm database. Opening this app and testing it manually does not result in any errors. I have written tests for the Realm database, such as: test(&...
user27793975's user avatar
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
0 votes
0 answers
43 views

How can I make my Jest test recognize jsx/tsx syntax?

My test is refusing to recognize < angle brackets. Jest encountered an unexpected token Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard ...
johnrubythecat'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
0 votes
0 answers
81 views

Mocking Value not working when passing through mockReturnValue

I'm trying to create some unit tests using jest and I'm trying to mock a simple value. It works when I pass the mock directly, but since I'm trying to test different scenarios, it isn't working when I ...
Pedro Almeida's 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
0 votes
0 answers
50 views

Can't get Jest tests to run with reactotron-redux with the following error - SyntaxError: Cannot use import statement outside a module

I have a React Native project and was able to setup reactotron-react-native and my tests were still working fine, but as soon as I installed reactotron-redux and set it up as per documentation, all my ...
Onyx's user avatar
  • 5,780
0 votes
1 answer
447 views

npm install is giving error - npm error ERESOLVE unable to resolve dependency tree

In my React Native with TypeScript project, I wanted to install dependencies. To install Testing Libraries I've used this command: npm install @testing-library/react-native @testing-library/jest-...
Mobile_Dev'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

15 30 50 per page
1
2 3 4 5
95