Testing Angular JS with WebStorm: unresolved function or method inject()

571 Views Asked by At

I'm developing web an app using AngularJS + TypeScript, and Karma + Jasmine for testing purposes.

The problem is that WebStorm continues pestering me with the following error, despite the fact that all of my tests compile well:

Unresolved function or method inject()

enter image description here

I've added angular-mocks typings:

enter image description here

and provided angular-mocks JavaScript library for IDE:

enter image description here

But the problem still exists. I know that as a workaround, one can declare corresponding variable, but honestly I don't really think that this is a good approach.

1

There are 1 best solutions below

2
lena On

Works fine for me using typings (npm i @types/angular-mocks):

enter image description here

Please try invalidating caches