A
A
Abr_ya2020-07-01 10:12:26
Software testing
Abr_ya, 2020-07-01 10:12:26

React - how to write tests so that the linter likes them?

Starting to use Jest + Enzyme in react apps.
Wrote a test as in the example, linter (eslint) does not like a lot of places:
5efc373b6e26d841310121.jpeg
What is the best thing to do? Disable linter for test files? Write tests differently somehow?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2020-07-01
@Abr_ya

You need to tell the linter that some globals.
Try to specify something like this in the eslint config for tests:

"env": {
    "jest": true
}

Or
"env": {
    "jest/globals": true
  }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question