All Questions
10 questions
3
votes
0
answers
805
views
Jest test cases failing due to timeout of react native test library
I am using jest for react-native test cases, after updating to jest v27.5.1, I started getting error for all of the async calls. I solved most of them by following this thread. After this I started ...
0
votes
1
answer
280
views
React native jest: While resolving: [email protected] npm ERR! Found: [email protected]
I am trying to install @testing-library/react-native to a freshly created expo-based react native application.
For adding test cases, I followed the steps mentioned in https://docs.expo.dev/guides/...
0
votes
1
answer
536
views
Why does Jest sometimes prints "pretty" error messages with line pointers, and sometimes not?
I have jest 27 installed, and I see that sometimes I get pretty error messages like this (with visual pointer to the failing line):
And sometimes it prints the errors like this (plain error, without ...
4
votes
3
answers
6k
views
Jest mock dimensions not changing
I am doing testing for the first time so I am pretty much sure that I am doing something wrong.
I was writing test case and my component does this internally.
const {width, height} = Dimensions.get('...
3
votes
0
answers
2k
views
react native testing library, No instances found with testID
Im getting the error,
No instances found with testID: CreateAccount.errorMessage
But Im referencing the ID on "CreateAccount.js"
<ErrorText
text={this.state.errorMessage}
...
1
vote
1
answer
717
views
React Native Testing Framework findBy doesn't find and waitFor doesn't wait
This is an image gallery and I'm confident it's working correctly. It runs fine in the simulator. I've tried to variations of the same test:
test('main image should display', async () => {
...
11
votes
2
answers
25k
views
"SyntaxError: Cannot use import statement outside a module" error while testing React Native project with Jest and @testing-library/react-native?
Error I'm getting Anytime I run npm test:
FAIL ./App.test.js
● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest ...
1
vote
0
answers
100
views
React-Native-Testing-Library 'warning - an updated was not wrapped in act(...)
I think this question has been asked, but no solution was provided.
I'm using RNTL trying to unit test a simple RN component.
My example below:
component = render(<ThemeProvider>
<...
4
votes
0
answers
2k
views
expect(jest.fn()).toHaveBeenCalledWith(...expected) in react-native and expo
I'm trying to write the unit test for the Controller which is written in react-native and expo Following is the login method for which Unit test is failing
login.tsx
import React, { useState } from '...
0
votes
1
answer
476
views
jest error: const warnedKeys: {[string]: boolean} = {};
If I run yarn test, which runs jest, I get the following error:
C:\react-native-project\node_modules\react-native\Libraries\Utilities\warnOnce.js:15
const warnedKeys: {[string]: boolean} = {};
...