# Testing JavaScript

> **TL;DR**
> Required plugins:
>
>
>
> `JavaScript and TypeScript`, a test framework-specific plugin (if applicable)

With CLion, you can run and debug JavaScript unit tests using [Mocha](http://mochajs.org/), [Jest](https://facebook.github.io/jest/), and [Protractor](http://www.protractortest.org).

> **Tip:**
> Use the dedicated plugins for [Karma](https://plugins.jetbrains.com/plugin/7287-karma) and [Cucumber.js](https://plugins.jetbrains.com/plugin/7418-cucumber-js) test frameworks.

You can see the test results in a treeview and easily navigate to the test source from there. Test status is shown next to the test in the editor with an option to quickly run or debug it:

![Run single test from the editor](https://resources.jetbrains.com/help/img/idea/2026.2/ws_run_test_from_editor.png)

For Jest and Mocha you can also see a code coverage report right in CLion.

## Navigation

CLion lets you quickly jump from the source code to the related test file with the Go to test action (`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)), `⌘ ⇧ T` (Xcode), `Ctrl+Shift+T` (Visual Studio), `Ctrl+Shift+T` (Visual Studio (macOS)), `Ctrl+Shift+T` (ReSharper), `Ctrl+Shift+T` (ReSharper (macOS)), `Ctrl+Shift+T` (QtCreator), `Ctrl+Shift+T` (QtCreator (macOS)), `Ctrl+Shift+T` (NetBeans), `Ctrl+Shift+T` (Eclipse), `Ctrl+Shift+T` (Eclipse (macOS)) or `Navigate | Test`). For example, from `auth.js` you can jump to `auth.test.js`.

You can also quickly navigate through a test file using the Structure view that shows the names of the tests and suites, as well as other symbols defined in this file.

![Structure view for tests](https://resources.jetbrains.com/help/img/idea/2026.2/ws_structure_view_for_tests.png)

To jump to the Structure tool window, press `Alt+7` (Windows), `⌘ 7` (macOS), `⌘ 7` (IntelliJ IDEA Classic (macOS)), `⌘ 7` (macOS System Shortcuts), `Alt+7` (XWin), `Alt+7` (GNOME), `Alt+7` (KDE), `Alt+7` (Emacs), `Alt+7` (Sublime Text), `⌘ 7` (Sublime Text (macOS)), `⌘ 3` (Xcode), `Ctrl+Alt+F` (Visual Studio), `⌃ ⌥ F` (Visual Studio (macOS)), `Ctrl+F11` (ReSharper), `⌃ F11` (ReSharper (macOS)), `Alt+7` (QtCreator), `⌘ 7` (QtCreator (macOS)), `Ctrl+7` (NetBeans), `Alt+7` (Eclipse), `⌘ 7` (Eclipse (macOS)). Alternatively, press `Ctrl+F12` (Windows), `⌘ F12` (macOS), `⌘ F12` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ 7` (macOS System Shortcuts), `Ctrl+F12` (XWin), `Ctrl+F12` (GNOME), `Ctrl+0` (KDE), `Ctrl+F12` (Emacs), `Ctrl+R` (Sublime Text), `⌘ R` (Sublime Text (macOS)), `⌃ 6` (Xcode), `Alt+\` (Visual Studio), `⌥ \` (Visual Studio (macOS)), `Ctrl+F12` (ReSharper), `⌘ F12` (ReSharper (macOS)), `Ctrl+F12` (QtCreator), `⌘ F12` (QtCreator (macOS)), `Ctrl+F12` (NetBeans), `Ctrl+F3` (Eclipse), `⌘ O` (Eclipse (macOS)) to open the Structure view as a popup in the editor.

## Run and debug tests

Before you start with testing JavaScript, make sure the chosen test runner is installed and set up in your project as described on the corresponding page.

During a test debugging session, you can [step through the tests](stepping-through-the-program.html), [stop and resume](null)   test execution, [examine the test when suspended](examining-suspended-program.html), [run JavaScript code snippets in the Console](interactive-debugger-console.html), and so on.

Procedure: Quickly run or debug a single test with Mocha or Jest

* To run a test, click ![the Run button](https://resources.jetbrains.com/help/img/idea/2026.2/app-client.expui.run.run.svg) or ![Rerun](https://resources.jetbrains.com/help/img/idea/2026.2/app.actions.rerun.svg) in the gutter next to it and select Run <test_name> from the list.

* To debug a test, [set the breakpoints](using-breakpoints.html) where necessary, click ![the Run button](https://resources.jetbrains.com/help/img/idea/2026.2/app-client.expui.run.run.svg) or ![Rerun](https://resources.jetbrains.com/help/img/idea/2026.2/app.actions.rerun.svg) in the gutter next to the test, and select Debug <test_name> from the list.

![Run and debug tests from the editor](https://resources.jetbrains.com/help/img/idea/2026.2/ws_test_run_debug_gutter.png)

Procedure: Create a run/debug configuration

1. In the [Run/Debug Configuration](run-debug-configurations-dialog.html) dialog (`Run | Edit Configurations`), click ![Add New Configuration](https://resources.jetbrains.com/help/img/idea/2026.2/app.expui.general.add.svg), and select the appropriate configuration type.

2. Accept the default settings or fill in the required fields with custom values, see Help for specific test frameworks.

Procedure: Run or debug tests using a run/debug configuration

* To run tests, select the required configuration and click ![the Run button](https://resources.jetbrains.com/help/img/idea/2026.2/app.expui.run.run.svg) or ![Run with Coverage](https://resources.jetbrains.com/help/img/idea/2026.2/app.general.runWithCoverage.svg) in the list of configurations or on the toolbar.

![Run widget: Run Test](https://resources.jetbrains.com/help/img/idea/2026.2/ws_js_test_run_widget_run.png)

* To debug tests, [set the breakpoints](using-breakpoints.html) where necessary, select the required configuration, and click ![Debug](https://resources.jetbrains.com/help/img/idea/2026.2/app.expui.run.debug.svg) in the list of configurations or on the toolbar.

![Run widget: Debug Test](https://resources.jetbrains.com/help/img/idea/2026.2/ws_js_test_run_widget_debug.png)

## See also

### Procedures

[Configure JavaScript libraries](configuring-javascript-libraries.html)

