Logo Questions Linux Laravel Mysql Ubuntu Git Menu

WebStorm, Karma, and Angular. How to debug the angular service

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.

like image 973
nograde Avatar asked Mar 21 '23 00:03


1 Answers

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

like image 198
Eitan Peer Avatar answered Apr 02 '23 15:04

Eitan Peer