Webstorm 11 - Run a single Mocha test
I see running a single Mocha test should be possible in Webstorm 11.
But I don't see anything when I righ-click a test name :
Am I missing something?
Thanks in advance.
Julien
Please sign in to leave a comment.
I see running a single Mocha test should be possible in Webstorm 11.
But I don't see anything when I righ-click a test name :
Am I missing something?
Thanks in advance.
Julien
Please sign in to leave a comment.
It's possible, but you need creating the corresponding run configuration:
See https://www.jetbrains.com/webstorm/help/running-mocha-unit-tests.html
It also works for me when using right-click menu:
But seems your specs are written in ES6, are they?
Elena,
Using a Mocha specific Debug Configuration, I'm indeed able to see the Run/Debug commands in the context menu.
But I'm using TypeScript and when I select the Run command from this context menu, I get an error :
Is there a way to make this work using TypeScript?
I'm mainly a Java developer and quite new to Node/Javascript/Webstorm... I mostly use cut and paste examples. So I'm not 100% sure if I'm using ES6 or not! ;-)
Thanks,
Julien
Error is expected - as you are running typescript file as javascript, and it can't be run directly, it has to be transpiled to javascript first. Please use Typescript compiler to transpile your tests, and then run the generated javascript tests
Indeed, it works when I right-click and choose "run" from the ".js" file instead of the ".ts" file.
Thanks!