DEV Community

Discussion on: Test Driven Development in an Angular World

Collapse
 
didirare profile image
didi-rare

Hi,

Thanks for your reply, I figured Jest is a test suite when i did some research, i had installed and configured it following their guide, however the test fails when i run it. I get this error message "error TS2304: Cannot find name 'jest'."

I had installed the jest package, @types/jest, jest-preset-angular and added jest in types [] in all tsconfig.*.json files and i still get the same error.

Do you have any pointers?

I use Webstorm IDE.

Thread Thread
 
cthulhu profile image
Catalin Ciubotaru

So, all I have it this in my tsconfig.spec.json:

"types": ["jest", "node"]

Keep in mind they are not needed in all the others tsconfig.*.json files.

Also make sure you also install jest, not just jest-preset-angular.
So, you need jest, @types/jest and jest-preset-angular; then add the "jest" types to tsconfig.spec.json and that should be it.

Sorry for the late answer. Holiday more :)