# JSTestDriver

> **TL;DR**
> Required plugins:
>
>
>
> `JavaScript and TypeScript` -    the plugin is bundled with IntelliJ IDEA and enabled by default.
>
>
>
> `JSTestDriver` -    install the plugin on the Settings | Plugins page, tab Marketplace.     The plugin is available only in IntelliJ IDEA with the Ultimate subscription.

IntelliJ IDEA supports integration with the [JSTestDriver test
framework](https://code.google.com/archive/p/js-test-driver/wikis/GettingStarted.wiki).

## Before you start 

Procedure:

1. Make sure the  JavaScript and TypeScript plugin is enabled in the settings.  Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Plugins`.  Click the Installed tab. In the search field, type JavaScript and TypeScript. For more information about plugins, refer to [Managing plugins](managing-plugins.html).

2. Install and enable the JSTestDriver plugin on the Settings | Plugins page, tab Marketplace, as described in [Installing plugins from
JetBrains Marketplace](managing-plugins.html#install_plugin_from_repo).     The plugin is available only in IntelliJ IDEA with the Ultimate subscription.

Through this plugin, IntelliJ IDEA provides the JSTestDriver server and the assertion framework. During the test creation, the plugin detects the unit testing framework and suggests the Add <test framework> support [intention action](intention-actions.html).

## Configuring a testing framework in a project

Procedure:

1. Download the framework of your choice and [configure it as an IntelliJ IDEA JavaScript library](configuring-javascript-libraries.html#ws_js_custom_third_party_library).

2. Do one of the following:

* [Add the project folder to the library scope](configuring-javascript-libraries.html#ws_js_configuring_js_libs_change_scope).

* Enable the framework support on-the-fly during test creation using the Add <test framework> support intention action.

* To use Jasmine, add `jasmine-jstd-adapter` to the configuration file. Open `jsTestDriver.conf` and type the following code in it: ``` load: lib/jasmine/jasmine.js lib/jasmine-jstd-adapter/JasmineAdapter.js ```

## Creating a test runner configuration file manually

A test runner configuration file defines the test and production files to load the loading order. IntelliJ IDEA treats any file with the extension `.jstd` or `.conf` as a test runner configuration file.

Procedure: To create a configuration file

1. In the Project tree, select the parent folder of the production and test folders, and choose New | File from the context menu.

2. In the New File dialog that opens, type the name of the configuration file with the extension `.jstd` or `.conf`.

3. Open the new file in the editor and specify the full path to the current folder and the paths to the files to load relative to it. Use wildcards in file name patterns.

4. Complete the configuration file using [YAML](http://www.yaml.org/), refer to [description of test
runner configuration files](http://code.google.com/p/js-test-driver/wiki/ConfigurationFile).

## Running tests

With IntelliJ IDEA, you can quickly run a single JSTestDriver test right from the editor or create a run/debug configuration to execute some or all of your tests.

Procedure: To run a single test from the editor

* Click ![the Run button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.run.run.svg) or ![the Rerun button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.actions.rerun.svg) in the left gutter and choose Run <test_name> from the list.

* You can also see whether a test has passed or failed right in the editor, thanks to the test status  icons ![Test passed](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.runConfigurations.testState.green2.svg) and ![Test failed](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.runConfigurations.testState.red2.svg) in the gutter.

> **Tip:**
> The arrows appear only if the test framework used in your tests is associated with the project, so IntelliJ IDEA can recognize the tests.

Procedure: To create a JSTestDriver run configuration

1. Open the [Run/Debug Configuration](run-debug-configurations-dialog.html) dialog (`Run | Edit Configurations` in the main menu), click ![the Add button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg) in the left-hand pane, and select JSTestDriver from the list.  The Run/Debug Configuration: JSTestDriver dialog opens.

> **Tip:**
> Alternatively,   select a test file in the   Project tool window  (`Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+1` (NetBeans), `Ctrl+Alt+L` (Visual Studio), `⌘ ⌥ L` (Visual Studio (macOS)), `Alt+1` (Eclipse), `Alt+1` (Eclipse (macOS)))  and select Create <filename> from the context menu.

2. Specify the tests to run, the path to the configuration file, and the activities to perform before test execution.

Procedure: To start the WebStorm default JSTestDriver test server

1. Make sure you have at least one configuration file in your project.

2. Open the JSTestDriver Server tool window (`View | Tool Windows | JSTestDriver Server`), and click ![the Run button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.run.svg) on the toolbar.

> **Tip:**
> To use a test server running on another machine or listening to a custom port, start it according to the server-specific instructions and specify its URL address in the Server area of the Run/Debug Configuration: JSTestDriver dialog.

Procedure: To stop the server when you are through with unit testing

* Click ![the Stop the local server button ](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.actions.suspend.svg) on the toolbar.

Procedure: To capture a browser

1. [Start the JSTestDriver Server](#start_server) if it is not running yet and then switch to the JSTestDriver Server tool window.

2. To start a local browser with the Remote Console of the  JSTestDriver, do one of the following:

* Click the icon that indicates the browser of your choice.

* If the browser is already opened, copy the contents of the Capture a browser using the URL read-only field and paste the URL in the address bar.

In either case, the icon that indicates the chosen browser becomes active.

3. Switch to the JSTestDriver Server tool window and click the icon that indicates the browser you just opened. IntelliJ IDEA displays a message informing you that it is ready for executing tests.

Procedure: To run tests via a run configuration

1. Select the JSTestDriver run/debug configuration from the list of configurations and click ![the Run icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.run.svg) in the list or on the toolbar.

2. Monitor test execution and analyze test results in the Test Runner tab of the Run tool window. For more information, refer to [Explore test results](viewing-and-exploring-test-results.html).

## Navigation

With IntelliJ IDEA, you can jump between a file and the related test file or from a test result in the [Test Runner Tab](null) to the test.

Procedure:

* To jump between a test and its subject or vice versa, open the file in the editor and select `Go to | Test` or `Go to | Test Subject` from the context menu, or just press `Ctrl+Shift+T` (Windows), `⌘ ⇧ T` (macOS), `⌘ ⇧ T` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ T` (macOS System Shortcuts), `Ctrl+Shift+T` (XWin), `Ctrl+Shift+T` (GNOME), `Ctrl+Shift+T` (KDE), `Ctrl+Shift+T` (Emacs), `Ctrl+Shift+T` (Sublime Text), `Ctrl+Shift+T` (Sublime Text (macOS)), `Ctrl+Shift+T` (NetBeans), `Ctrl+Shift+T` (Visual Studio), `Ctrl+Shift+T` (Visual Studio (macOS)), `Ctrl+Shift+T` (Eclipse), `Ctrl+Shift+T` (Eclipse (macOS)).

* To jump from a test result to the test definition, click the test name in the Test Runner tab twice, or select `Jump to Source` from the context menu, or just press `F4` (Windows), `⌘ ↓` (macOS), `F4` (IntelliJ IDEA Classic (macOS)), `F4` (macOS System Shortcuts), `F4` (XWin), `F4` (GNOME), `F4` (KDE), `F4` (Emacs), `F4` (Sublime Text), `F4` (Sublime Text (macOS)), `F4` (NetBeans), `F4` (Visual Studio), `⌘ ↓` (Visual Studio (macOS)), `F12` (Eclipse), `F3` (Eclipse (macOS)). The test file opens in the editor with the caret placed at the test definition.

## Debugging tests

A debugging session for JSTestDriver tests is started only through a run/debug configuration.

Procedure: To start debugging tests

1. Create a JSTestDriver run/debug configuration [as described above](#create_JSTestDriver_configuration).

2. Select the JSTestDriver run/debug configuration from the list of configurations and click ![the Debug icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.debug.svg) in the list or on the toolbar.

3. In the [Debug tool window](debug-tool-window.html) that opens,   proceed as usual: [step through the program](stepping-through-the-program.html),  [stop
and resume](starting-the-debugger-session.html#pause-resume)  program execution, [examine it when suspended](examining-suspended-program.html), explore the call stack and variables, set watches, evaluate variables, [view actual HTML DOM](viewing-actual-html-dom.html), and so on.

To ignore source maps and step through the actually executed code, press ![the Disable Source Maps toggle button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sourceMapDisable.png) on the toolbar of the Debug tool window.

## Monitoring code coverage

With IntelliJ IDEA,    you can also monitor how much of your code is [covered with Karma tests](http://en.wikipedia.org/wiki/Code_coverage). IntelliJ IDEA displays this statistics in a dedicated Coverage tool window and marks covered and uncovered lines visually in the editor and in the   Project tool window  (`Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+1` (NetBeans), `Ctrl+Alt+L` (Visual Studio), `⌘ ⌥ L` (Visual Studio (macOS)), `Alt+1` (Eclipse), `Alt+1` (Eclipse (macOS))) .

Procedure: To launch tests with coverage

1. Create a JSTestDriver run/debug configuration [as described above](#create_JSTestDriver_configuration).

2. [Start the JSTestDriver server](#start_server) and [capture a browser](#capture_browser) to run the tests in.

3. Select the JSTestDriver run/debug configuration from the list of configurations and click ![the Run with Coverage icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.general.runWithCoverage.svg) in the list or on the toolbar.

4. Monitor the code coverage in the [Coverage](code-coverage.html) tool window.

Procedure: To exclude files from coverage analysis

1. Create a JSTestDriver run/debug configuration [as described above](#create_JSTestDriver_configuration).

2. In the Coverage tab, specify the paths to the files to exclude.

## See also

### Procedures

[Testing frameworks](testing-frameworks.html)

