Can Webstorm play well with Chai language chains?

I am using Mocha + Chai for the current Node.js project. My IDE is Webstorm 11.

Unfortunately, it seems that Webstorm has no way to understand how language chains in Chai / expect should work / should exist. The following is a common occurrence:

enter image description here

I tried to explicitly set both Chai and Chai-DefinetlyTyped as libraries for my project through Settings->Javascript->Libraries , but this does not allow anything.

To support the tool, I considered dropping expect / should for assert instead, as this works fine. However, I really prefer the expect / should style, so it would be great to see a solution to this.

+6
source share
1 answer

The problem is caused by the strange dynamic way that these chains define. As a workaround, I can suggest using chai.d.ts:

  • Open " Settings | Languages & Frameworks | JavaScript | Libraries "
  • Click the " Download... " button and select "TypeScript Community Stubs"
  • Find "chai" and click on " Download and Install ".
+20
source

All Articles