Jest / ESLint fail is not defined

I've just generated a fresh project with npx react-native init and ESLint is complaining in one of my test files:

   9:1   error  'describe' is not defined    no-undef
  12:5   error  'beforeEach' is not defined  no-undef
  16:5   error  'afterEach' is not defined   no-undef
  20:5   error  'test' is not defined        no-undef
  28:17  error  'fail' is not defined        no-undef
  30:13  error  'expect' is not defined      no-undef

Based on the docs and this thread, I've added:

env: {
    jest: true,
},

to my .eslintrc.js file. However, ESLint is still complaining with:

  28:17  error  'fail' is not defined  no-undef

Has anyone already experienced and solved this issue ?

Here are the jest dependencies versions in package.json:

"babel-jest": "^26.5.2",
"jest": "^26.5.3",

Solution 1:

Ok so it turns out Jest uses Jasmine's fail().

Updated .eslintrc.js by adding Jasmine and it works. No more errors.

env: {
    jasmine: true,
    jest: true,
},