Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

This tutorial describes how to use the Karma test runner in the WebStorm IDE.

Table of Contents

Karma integration in WebStorm


Starting with WebStorm 7.0, you can use the Karma test runner to run JavaScript tests for your project.
Karma integration in WebStorm:


Installing Karma

First, make sure that Node.js is installed on your computer.

Install Karma using npm:

  • Globally

Open WebStorm’ built-in Terminal (on the main menu, choose Tools | Open Terminal) and run

Code Block
npm install -g karma

to install Karma into your global node_modules directory and create a symlink to its binary.

Image Removed

  • Locally

The recommended approach is to install Karma (and all the plugins your project needs) locally in the project's directory.

Use WebStorm’ built-in npm ( Image Removed on the toolbar or in Settings | JavaScript - | Node.js pageand NPM) search and install Karma for your project.


Code Block
npm install karma

Install karma-cli globally:

Use WebStorm’ built-in npm and search for karma-cli, add -g option before hitting Install for global installation.
Or use built-in Terminal to install karma-cli with:

Code Block
npm install -g karma-cli

Karma configuration

To run new tests with Karma, you need to have a Karma configuration file (learn more about it).



Note: WebStorm disables autoWatch in Karma configuration.
You can rerun your tests with the shortcut CtrlAlt+Shift+R on Win/Linux or ctrl-cmd-R on Mac.
Click auto-test in the WebStorm Test Run window to enable automatic test rerun: The test will be run 10 seconds after your code was changed, if there are no syntax errors.


Make the required changes in the Karma configuration file, for example:

Code Block
    reporters: ["coverage"],
    preprocessors: {
        "**/*.js": "coverage"