"Cannot find name 'jest'" Typescript error

A little bit green with Webstorm. Can't solve this problem with typescript compiler service flagging an error for TS2304: Cannot find name 'jest'.  Do I need to change my run configuration for jest?

My tests still run as expected with no problems, but the intellisense is flagging some jest keywords.  Any suggestions?

4 comments

Try adding jest typings to your project (npm i @types/jest) - does it help? Typings added via Settings | Languages & Frameworks | JavaScript | Libraries are not available to compiler, you need to install them to the project folder to get the project compiled

0

I have added jest typings to my project. here is my `devDependencies` within package.json:

I do not have this problem in VS Code, so I was suspicious that there may be a setting within WebStorm that I was missing?

0

works fine for me using exactly same @types/jest version

how many tsconfig.*.json files do you have in your project? what do they look like? Please share a project I can use to recreate the issue

0

bingo. this was it. I have a couple of different tsconfig.*.json files in my project. adding "jest" to "types" within one of them solved the problem. thank you.

1

Please sign in to leave a comment.