4
votes

I suppose I'm asking about what the proper procedure is.

I'm running Webstorm 7.0.3. I do not have node setup. I'm using the in place hosting on my local machine.

I have written unit tests, and can put a debug breakpoint in the test.js file. When I right-click and 'debug' my karma.conf.js file, it hits these breakpoints fine. Which is great for for basic stuff, but sometimes I need to go line by line inside a service.

Any breakpoints I place inside the service get skipped and ignored.

I have to assume this is is because karma is wrapping my actual script into some proxy file for execution.

How do I step through the service line by line? I feel like I missed something very obvious.

[Update] @Eitan's comment was what i needed. I assumed the karma task runner automatically wrapped all source up into the indecipherable un-debuggable non-sense. I never stopped to assume that putting the coverage pre-processor was responsible for it. Commenting the coverage reporter and pre-processor for karma-coverage now allows me to debug my unit tests from the karma chrome instance and from webstorm.

2
Are using the coverage reporter? It uses instrumented code so I guess you won't be able to debug your original file - Eitan Peer
zomg, Eitan, can you make your comment and answer so i can accept it? - nograde

2 Answers

5
votes

Are using the coverage reporter? It uses instrumented code so I guess you won't be able to debug your original file

2
votes

You could launch chrome in your karma config and step through your service with dev-tools. I don't know if you can actually do it from within WebStorm because of the exact reason you mentioned (karma server). Just click the big DEBUG button on the upper right of the karma controlled chrome instance and open the scripts in dev-tools