csvan
csvan

Reputation: 9464

Can Webstorm play nice with Chai language chains?

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

Unfortunately, it seems Webstorm has no way of figuring out how language chains in Chai's should/expect are supposed to work. The following is commonplace:

enter image description here

I have tried explicitly setting both Chai and Chai-DefinetlyTyped as libraries for my project via Settings->Javascript->Libraries, but this does not resolve anything.

For the sake of tool support, I have considered dropping expect/should for assert instead, as this works perfectly. However, I very much prefer the style of expect/should, so it would be amazing to see a solution to this.

Upvotes: 18

Views: 4095

Answers (1)

lena
lena

Reputation: 93748

Problem is caused by weird dynamic way these chains are defined. As a workaround I can suggest using chai.d.ts:

  • Open "Settings | Languages & Frameworks | JavaScript | Libraries"
  • Click "Download..." button and select "TypeScript community stubs"
  • Find "chai" and click "Download and Install".

Upvotes: 44

Related Questions