Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webstorm Karma test debugging - breakpoint not hit

I have installed the chrome jet brains extension

I have tests like this:

describe('Service tests', function () {


 beforeEach(module('app'));

    it('should have a Service', inject(function($injector) {
        var exist = $injector.has('dataService');

etc

but no luck getting breakpoints to hit any where in the tests. I can get the debugger to break when writing debugger, but an unable to step through.

like image 230
FutuToad Avatar asked Jan 20 '14 13:01

FutuToad


2 Answers

Do you have karma-coverage set up in your karma config? It uses instrumented code, so debugging is not possible. Related tickets: http://github.com/karma-runner/karma/issues/630, http://youtrack.jetbrains.com/issue/WEB-8443

like image 168
lena Avatar answered Sep 23 '22 10:09

lena


If you are building with Webpack you might need to specify the devtools option in your webpack config property in karma.conf.js like this:

module.exports = (config) => {
    config.set({
         webpack: {
             ...,
             devtool: 'inline-source-map'
         }
    })
};

This solution works for me with Webpack v3.

like image 40
Anna Tolochko Avatar answered Sep 24 '22 10:09

Anna Tolochko