Jasmine 2.0 methods not recognized by Webstorm 8

Hi all!

We have just upgraded karma-jasmine to the newest version (npm install karma-jasmine@2_0 --save-dev).
It now uses Jasmine 2.0.

However, Webstorm does not seem to recognize Jasmine 2.0 methods anymore (e.g. "describe", "it", "spyOn" etc.).

Jasmine is correctly defined as a JavaScript Library in Webstorm. I think the problem is that Jasmine 2.0 does not define its functions globally anymore. Back in 1.3 "beforeEach" looked like this in jasmine.js:

var beforeEach = function(beforeEachFunction) {
  jasmine.getEnv().beforeEach(beforeEachFunction);
};


In 2.0 beforeEach is defined like this:

this.beforeEach = function(beforeEachFunction) {
     currentSuite.beforeEach(beforeEachFunction);
};


Does anyone have a solution how I could get Webstorm 8 to recognize Jasmine 2.0 syntax?
Or maybe how I could force Webstorm Inspection to ignore certain globals such as "describe" or "it" (e.g. the same way I can get JSHint to ignore certain globals)?


Cheers Michael

2 comments
Comment actions Permalink

The easiest way to get rid of these errors is using Jasmine TypeScript stubs for type hinting/completion in WebStorm (instead of using actual jasmine 2.0 library).
Settings/javascript/Libraries,  press Download.., choose 'Typescript community stubs' in the combobox,  then select 'jasmine' in the libraries list and press 'download and  install'.

0
Comment actions Permalink

Hi Elena

It worked! Thanks a lot.

Regards
Michael

0

Please sign in to leave a comment.