Context menu for Jasmine file offers to create nodejs runner, not karma runner


I am developing a Ruby/Sinatra back end with a AngularJS front end. I am pleased with the support RubyMine has for JavaScript and AngularJS.
However, there is one issue.

Here is what happens

When I select a Jasmine test file, open the context menu, then RubyMine offers to create a node.js run configuration,

Here is what I expect

When I select a Jasmine test file, open the context menu, then RubyMine offers to create a karma run configuration.

On my previous computer (which I no longer have) this was not a problem, it worked as expected.
Sine I have many Jasmine test files, this is a nuisance.

Any help appreciated

some background

I installed nodejs etc as outlined in

I create run configurations as outlined in

  1. Open the Run/Debug Configuration dialog box by doing one of the following:
    • On the main menu, choose Run | Edit Configurations.
    • Press RunConfiguration and choose Edit Configuration on the context menu.
    • Open the test file in the editor, and then choose Create <file name> on the context menu.
    • Select the test file in the Project tool window, and then choose Create <file name> on the context menu of the selection.

the third point does not work for me.

Comment actions Permalink

I voted.
Meanwhile is there some sort of workaround?

I wonder where the association between filetype and the "create..." context menu is configured in RubyMine.
Where is it configured that a .js file is associated with "create nodejs runner"?
is there some config file that can be tweaked?
Like associate .test.js files with "create karma runner" instead?

Also the issue you refer to mentions something that I myself am not aware about
"you need changes in karma"
Is there anything that I should have changed in karma??


Comment actions Permalink


Unfortunately, there are no workarounds: files are associated with runners in java code only, no configs that can be tweaked.
Anyway, at the moment Karma doesn't support running single test file / single test, because this functionality depends on particular test framework.
See for more information.

If you're using Jasmine, it has "iit/ddescribe" to run single test.
Currently, recommended workflow is to change your js test file (for example, add "iit" instread of "it") and rerun all your tests by right clicking your karma.conf.js and selecting "Run ...".

The phrase "you need changes in karma" means that Karma should introduce some common mechanism for specifying test names to run.

Comment actions Permalink

Thanks for clarifying this.

I still wonder how my previous installation of RubyMine on my old computer (that I no longer have) managed to associate the karma runner with a .js file.
I an 100% positive this was the case, I demoed it to my colleages when we were discussing the relative merits of testem and karma as test runners.
Maybe I will try to recreate this one day, but not right now, it's quite an effort.

Comment actions Permalink

Sorry, I've forgotten to mention that Karma runner is associated with these file name patterns:


Maybe your .js file name was matched by one of these patterns.

Comment actions Permalink

This is helpful.

My workaround now is as follows.

for each file <some-unit>.js, I will create two files
        <some-unit>.test.js # contains jasmine specs
        <some-unit>.conf.js # contains karma configuration
where the test.js file contains the jasmine specs
and where the *.conf.js file contains the karma configuration to run the companion .test.js file (and nothing else)

When TDD-ing <some-unit> I will select the *.conf.js file and create and run a karma runner from the context menu.

Apart from having two files instead of one, this is actually just what I want.
I am not interested in running a single Jasmine spec. I always run the entire jasmine spec file.

The one thing missing is the ability to run all tests contained in a folder, like "Run all specs" context menu for Ruby/RSpec.
As a workaround, I will create a test.conf.js file that runs all the tests in the test directory.

For me this is workable.

Comment actions Permalink

Yes, that works. Possible side-effect is that for each "<some-unit>.conf.js" a new karma server will be started, instread of one for all tests.
Hope in WebStorm 10, it would be possible to run a single test out-of-the-box.


Please sign in to leave a comment.