I recently started adding Test coverage to a react-native project and one our determination as a team is to have zero ESLint warnings throughout the code-base.
The issue with Jest is that it's built-in functions such as
expect are implicitly defined in the global js context of the test file, so at runtime the test suite works correctly but ESLint reports such functions as
The solution is to enable the
jest plugin for eslint:
yarn add eslint-plugin-jest
Then in your
.eslintrc.json enable jest globals:
That's pretty much it.