Running Mocha Unit Tests
On this page:
Download and install Node.js. The framework is required for two reasons:
- The transpiledLanguage toolType is started through Node.js.
- NPM, which is a part of the framework, is also the easiest way to download the transpiledLanguage toolType.
If you are going to use the command line mode, make sure the following paths are added to the
- The path to the parent folder of the Node.js executable file.
The path to the
This enables you to launch the transpiledLanguage toolType and npm from any folder.
- Make sure the Mocha test framework is installed as described in Preparing to Use Mocha Test Framework.
- Make sure the Node.js plugin is enabled. The plugin is bundled with WebStorm and activated by default. If it is not, enable it as described in Enabling and Disabling Plugins.
- Make sure the Mocha plugin is enabled. The plugin is bundled with WebStorm and activated by default. If it is not, enable it as described in Enabling and Disabling Plugins.
Creating a Mocha run configuration
Open the Run/Debug Configuration dialog box by doing one of the following:
- On the main menu, choose .
- Open the test file in the editor, and then choose Create <file name> on the context menu.
- Select the test file in the Project tool window, and then choose Create <file name> on the context menu of the selection.
- Click the Add button on the toolbar and select the Mocha configuration type.
- In the dialog box that opens, specify the location of the Node.js and Node package, the working directory and the test directory, and choose the interface used in the test to run.
- Apply the changes and close the dialog box.
Last modified: 22 May 2015