How can I get WebStorm to recognize Jasmine methods?

You can use predefined JS library stubs in Webstorm/PHPStorm/Idea

  • Open File > Settings...
  • Select Languages & Frameworks > JavaScript > Libraries
  • Click on Download...

JavaScript Library settings

  • Swich to TypeScript community stubs
  • Find karma-jasmine (originally under the name jasmine) (If this does not work, try jasmine instead)
  • Click on Download and Install

enter image description here

I am using this setup with Jasmine 2.0


On a mac with webstorm 2016.1.1 i did the following :

  1. Open Preferences (webstorm->preference or [command + ,] )
  2. Go to libraries and frameworks -> javascript -> libraries
  3. download
  4. select 'jasmine - DefinitelyTyped' from the list

Jasmine support added to webstorm


Note, if you are using a Code Quality Tool such as JSHint with WebStorm, adding the global jasmin/karma-jasmine library did not get rid of the JSHint errors.

You need to access the JSHint settings via WebStorm's menu system (Lang & Frameworks>JavaScript>Code Quality Tools>JSHint) and click the checkbox to enable it know which environment it is running in.

JSHint setting


Using TypeScript (and Angular2) you just need to enable the TypeScript compiler in the WebStorm Settings ...

Settings > Languages & Settings > TypeScript ...

Under the Compiler heading tick ...

Enable TypeScript Compiler ...

(I also clicked the use tsconfig.json radio)

Jasmine methods will now be recognised


This could also be caused by a missing dependency (if you're developing in TypeScript).

Make sure you've installed @types/jasmine

npm install --save-dev @types/jasmine