1

I started testing the react native application with jest I started testing the App.js file and found "dependency" errors with node modules. But one of the mistakes I can't solve is this one.

enter image description here

I don't understand the error and I don't know how to solve it

__tests__/App.js

import 'react-native'
import React from 'react';
import renderer from 'react-test-renderer';
import App from '../App';


describe('Some component', () => {
  beforeAll(() => {
    jest.mock('@react-native-community/async-storage');

  });

  it('renders correctly', () => {
    const tree = renderer.create(
        <App/>
    ).toJSON();
    expect(tree).toMatchSnapshot();
  });
});

package.json

...    
"jest": {
        "preset": "react-native",
        "cacheDirectory": "./cache",
        "coveragePathIgnorePatterns": [
          "./app/utils/vendor"
        ],
        "coverageThreshold": {
          "global": {
            "statements": 80
          }
        },
        "transformIgnorePatterns": [
          "/node_modules/(?!react-native|react-clone-referenced-element|react-navigation|native-base-shoutem-theme|native-base|lodash|static-container|@react-navigation|react-native-rfid-nfc-scanner)"
        ],
        "setupFiles": [
          "./node_modules/react-native-gesture-handler/jestSetup.js"
        ]
      },
...
skyboyer
  • 22,209
  • 7
  • 57
  • 64
diego
  • 408
  • 8
  • 21

0 Answers0