With GoLand, you can test Node.js applications using numerous frameworks. Since May 2018, Nodeunit is deprecated, see the Nodeunit Official website.
Before you start
Creating and running unit tests for Node.js applications
- Enable nodeunit support.
- Write the unit tests.
- To have GoLand recognize the unit tests and detect the corresponding production source code, mark the folder where the unit tests are stored as a test folder.
- Create a run configuration of the type Nodeunit.
- Launch unit tests and monitor test results in the Run tool window.
Creating Nodeunit tests
- Create a folder test at the same level as the src folder
- Populate the test folder. For each production file, create a separate test file.
- Mark the folder where the tests are stored as test folder.
Creating a Nodeunit run configuration
- Open the Run/Debug Configuration dialog box by choosing on the main 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.
- Specify the Node.js interpreter to use. This can be a local Node.js interpreter or a Node.js on Windows Subsystem for Linux.
- 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.
Last modified: 15 August 2018