Test React Native Apps with React Native Testing Library

Configuring Jest and React Native Testing Library

yarn add --dev jest jest-expo jest-fetch-mock react-native-testing-library react-test-renderer

App/index.test.js

test('it works', () => {
  expect(true).toBeTruthy();
});

package.json

{
  // ...
  "jest": {
    "preset": "jest-expo",
    "transformIgnorePatterns": [
      "node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base)"
    ]
  }
}

Want to track your progress? Create an account with React Native School!

Continue

Join the email list to be notified of all new lessons and classes!