Compatible with:  IntelliJ IDEA , PhpStorm , PyCharm , RubyMine , AppCode , CLion
248 634
Integration with Karma, a spectacular test runner for JavaScript

Download plugin

Plugin is not working with Webstorm 2016.2 build#162.1121.31 Browser hangs when running tests in debug mode
You should add an additional parameter for the "singleRun" setting so that if it is set to true, it closes the Karma server after capturing the test results. This will give the test plugin the feel of running JUnit tests. Or, in general, allow for passed parameters like JUnit's "VM Options" field
What should be done in order to enable browserify preprocessing with karma from within idea? Is this a planned feature?
The latest version of plugin keeps crashing Dartium browser when a debug configuration is launched. It always gets me to "http://localhost:9876/debug.html" and I get the Aw Snap!. If I hit the url manually everything works fine (besides I can't use Webstorm to debug dart application)
Hi, thanks, reproduced. No, unfortunately, there is no way. See https://github.com/cjohansen/karma-browserifast/issues/23.
Hi, is there any chance to use this plugin combined with browserify and automatic reload on code change? Until now, the tests are rerunned by Intellij but the code is not up2date, because there isnt a new invocation of browserify. I use karma-broswerifast for this (see github for an example config) and it works great on commandline :) (latest intellij idea and node/npm/karma)
Unfortunately, I cannot reproduce the issue. To find out the cause your idea.log is needed (on the main menu "Help | Show Log in...").

Could you please create an issue with attached log in our bugtracker?

I would love to use this plugin but I'm getting an error that I can't over come. I've trie d re-installing the plugin many times. PHPStorm 7.1.2 Build PS133.803 Plugin Version: 133.434 { [Error: Cannot find module './intellijCli'] code: 'MODULE_NOT_FOUND' } Error: Cannot find module './intellijCli' Any help?
Ah right, I was using wrong node package. It turns out that the karma is installed both locally and globally and global one was selected by default in the karma run config. Thanks!
Hi, please try to run karma tests outside the IDE (using the console). You should use the same karma package as specified in "Karma node package" field of Karma run configuration.

Will the problem with "ng-html2js" still persist? If yes, please file an issue in our bugtracker.

Hi Sergey I didn't see your message, sorry... Here's the update. After I've read your message I tried it again without any changes, simply clicked on "Run" and it worked for most of the tests! We've changed a lot in the config so I can't tell what was the problem... However there's another problem now, it says: WARN [preprocess]: Can not load "ng-html2js", it is not registered! Perhaps you are missing some plugin? What we have in the karma config file is: preprocessors: { '**/*.coffee': ['coffee'], '**/*.html': ['ng-html2js'] } and the module karma-ng-html2js-preprocessor is under the node_modules directory too... It doesn't complain about the coffeee preprocessor but we don't use it anyway so probably karma is not trying to load it at all...
Ozan, you're using https://github.com/karma-runner/karma-commonjs. Right?

Indeed, the plugin runs karma with working directory set to the config's directory. If you find a glitch here please file an issue in the bugtracker.

Actual working directory could be found by adding extra logging to /path/to/karma/lib/server.js: "console.log(process.cwd());"

If 'commonjsPreprocessor' is specified, then 'commonjsPreprocessor.modulesRoot' is resolved against the working directory (i.e. the config's directory). Otherwise, "karma.basePath/node_modules" is assumed (i.e. the working directory isn't involved in resolution).

It cannot find the modules if the test directories is not at the root directory I think? Our directory structure ise like: /ui/test/* --> test related files /ui/node_modules/ --> we have the modules So it complains about being not able to find the modules. If I create a new project with "ui" as the root directory it works OK. In fact we're defining the base dir in the config file so I think the plugin should be run in that directory, or I don't know if we can specify the working directory by setting some environment variable or so...
I'm sorry, Michael, but there are no plans for releasing Karma plugin for IntelliJ IDEA 12. The problem is that Karma plugin relies on IntelliJ IDEA 13 API and other internal stuff (for example, it uses a new index that was introduced in IDEA 13).

Sorry again. The plugin's compatible with IntelliJ IDEA 13 or higher.

About upgrading to version 13: checkout additional options.

Please  sign in  to leave a comment.