Search code examples
javascriptkarma-runnerwebstorm

Triggering Karma tests in the test runner


I am having a small issue with WebStorm that I am hoping someone has experienced and solved before.

I am using WebStorm to build a angular.js app and I have it set up to use Karma to run my tests. This is fine for the most part: I have a Karma configuration setup and I can get to to run the tests or debug them with no issue.

My problem is that when I try to run a test individually by clicking on one of the test in the "Test Run" tree it goes off to a node configuration, tries to run it and fails (because its looking for js dependencies). After that I just go back to my 'karma config' and it runs through the whole of the test no problem.

Does anyone know how I can get the IDE hooked up so that I can trigger my tests from the UI?


Solution

  • Running tests from file right-click menu is only supported for those runners that allow executing individual tests (JSTestDriver, for example). There is currently no such possibility for Karma (WEB-13173). See the discussion at https://github.com/karma-runner/karma/issues/1235.

    to run individual test files, you can have several karma configuration files with different sets of tests included. Plus you can rename individual tests/suits in the way mentioned in https://github.com/karma-runner/karma/issues/553