83

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?
dwjohnston
  • 11,163
  • 32
  • 99
  • 194
tmp dev
  • 8,043
  • 16
  • 53
  • 108

2 Answers2

245

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

TL;DR;:

add the following to your .eslintrc file:

"env": {
    "jest": true
}
SunshinyDoyle
  • 3,441
  • 1
  • 18
  • 21
  • You can find all the configuration details for other unit test libraries @ [ESLint Specifying Environments](https://eslint.org/docs/user-guide/configuring#specifying-environments) – greemwahr Mar 16 '18 at 11:45
-3

Are your test files under a the "test" folder? make sure jest is install properly and listed on your package.json and under scripts have:

"test": "jest --coverage",

you can run the script with npm test

Julito Sanchis
  • 1,406
  • 2
  • 10
  • 10