WebStorm supports integration with the nodeunit framework thus enabling running unit test for Node.js applications.
- Enable nodeunit support.
- Write the unit tests.
- To have WebStorm recognize the unit tests and detect the corresponding production source code, mark the folder where the unit tests are stored as test folder.
- Create a run configuration of the type Nodeunit.
- Launch unit tests and monitor test results in the Run tool window.
This topic provides guidelines in Node.js-specific unit testing procedures. For general information on testing in WebStorm, see the section Testing.
Open the Run/Debug Configuration dialog box by doing one of the following:
- On the main menu, choose .
- Press RunConfigurationRunConfigurationRunConfigurationRunConfigurationRunConfigurationRunConfigurationRunConfigurationRunConfigurationRunConfigurationRunConfigurationRunConfiguration and choose Edit Configuration on the context menu.
- Click the Add button on the toolbar and select the Nodeunit configuration type.
In the dialog box that opens, specify the following:
- The name to identify the configuration.
The path to the NodeJS installation to use.
If you have appointed one of the installations as default, the field displays the path to its executable file.
- The working directory. This can be the project root folder or the parent directory for the test folder.
The scope of tests to run.
- Apply the changes and close the dialog box.