JillAndMe
JillAndMe

Reputation: 4571

'test' is not defined. (no-undef)

I'm using eslint(JavaScript Standard Style) with jest

lint keeps me warning about jest's functions are not defined.

I tried

/* eslint-env jest */

It works but, I don't want to use it in every test.js file. so I tried.

.eslintrc (in root directory)

{
    "env": {
        "jest": true
      }
}

but, doesn't work. any ideas?

Upvotes: 9

Views: 5814

Answers (1)

Emilio Ferrer
Emilio Ferrer

Reputation: 350

Using:

"env": {
    "jest": true
}

in the .eslintrc.json file, it solved the problem for me.

Upvotes: 22

Related Questions