IntelliJ IDEA 2017.1 Help

Testing JavaScript

This feature is supported in the Ultimate edition only.

In IntelliJ IDEA, you can run JavaScript test cases, methods, or entire test files against a local or remote test server using Cucumber.js, Jest, JSTestDriver, Karma, Mocha, or Protractor.

You can quickly jump from source code to the related test file with the Go to test action (Ctrl+Shift+T or Navigate | Test). For example, from auth.js you can jump to auth.test.js.

You can also see whether a test has passed or failed right in the editor, thanks to the test status icons ws_icon_test_status.png in the left gutter.

For Mocha and Jest, you can run and debug tests and suites right from the editor: click run.png or rerun.png in the left gutter and choose Run <test_file_name> or Debug <test_file_name> from the pop-up list.

ws_run_test_from_editor.png

With JSTestDriver and Karma, you can also monitor how much of your code is covered with tests. IntelliJ IDEA displays this statistics in a dedicated tool window and marks covered and uncovered lines visually right in the editor.

In this part:

See Also

Last modified: 5 April 2017