Fix element is not imported jest/describe/it/expect in Webstorm
If you are writting tests with Jest in Webstorm and are annoyed with underline functions with message
Unresolved function or method, there is one nice solution I couldn’t find easy.
npm install -g @types/jest
It will be saved in global node modules directory on location:
Now it needs to be added in Webstorm:
Cmd+Shift+G and type
jest and choose
You will have something like this:
OK first screenshot is going to be like this:
Bonus: Autocomplete works too :)
Note: If you prefer, you can add
@types/jest locally with or without option
--save-dev (In that case you will add index.d.ts from different location). If you don’t use save-dev, you need to repeat procedure after every update to project’s node modules.