Using jest in my react app, describe is not defined

tmp dev picture tmp dev · Jun 18, 2017 · Viewed 27.6k times · Source

I am new to jest and trying to figure out some basic stuff in my following code

import * as actions from './IncrementalSearchActions';

describe('Incremental Search Actions', () => {
    it('Should create an incremental search action')
});

The questions/confusions I have around this are

  1. I get an error saying describe is not defined, how do I import the reuqired module?
  2. Is this supposed to be used with Karma/Jasmine?

Answer

SunshinyDoyle picture SunshinyDoyle · Aug 24, 2017

I believe the answer here is the answer to your question.

TL;DR;:

add the following to your .eslintrc file:

"env": {
    "jest": true
}