NodeJS - Run Mocha integration-test that require the server to run

I'm developing NodeJS app. My unit test run agienst the code without requiring the server to actually run and my integration test need to run agienst the running server.
When I work with terminals I simply have 2 terminals, in one I run the server and on the other I run the mocha tool.
Is it possible to run those integration mocha test inside WebStorm? If I configure the test to run another tool before launch it does not run the server because I configure it to run the node server which will never finish.

Thank you,
Ido.

4 comments
Comment actions Permalink

Well... Just create a Node.js runconfiguration for your server (if it's a Node.js server) or configure it as external tool, and make sure to start this configuration/tool before running your Mocha configuration. If you like to do this in one click, try recording a macro...

0
Comment actions Permalink

Hi, I try to go that way but WebStorm wait for the external tool to exit before running the text and node will never exist.

0
Comment actions Permalink

This only happens if you add your tool to 'before launch' section of Mocha run configuration (as the main process is waiting for return code from the process launched before it). You need to remove your tool from 'before launch' section and start it manually (using menu action or shortcut) before running your mocha configuration

0

Please sign in to leave a comment.