Search code examples
typescriptidemocha.jswebstorm

Mocha WebStorm integration


WebStorm has this nifty feature that when you write tests with Mocha using the standard describe() and it() keywords it will add a small arrow next to the keywords to run them manually.

Here's the issue, I need to do extra-pretest-setup across tests so I have custom methods for describe, it. They are called setupNewSuite and createNewTest > due to name change WebStorm no longer shows the little arrows.

I want WebStorm to treat setupNewSuite as if its describe and createNewTest as if its it.

(P.S it might be possible to trick it using the same original names but if that's the case I'll just drop this)


Solution

  • the IDE is statically analyzing the source code looking for known code patterns when detecting the test files. Obviously, setupNewSuite and createNewTest wrappers are not known, so your tests are not detected and can't be run from the sidebar. There are no workarounds unfortunately.

    We have a feature request for providing support for custom test/suite names, WEB-37848, please feel free to vote for it.