angularvisual-studio-codekarma-jasmineangular-cli

Debug Tests in NG Test


I am using Angular CLI and VSCode but none of my breakpoints in my spec files seem to be getting hit when I run ng test?

Do I need to do some config?


Solution

  • Update for Angular version 9

    The source files have been moved but you can still debug this way if you do the following steps

    enter image description here

    Valid for versions below 9

    The other answers are completely valid answers but having been using Angular for around 18 months now I tend to do it in the browser - chrome tools!

    Run ng test then f12 and find the spec file via the webpack context. Add a breakpoint(s) and refresh and it will hit said breakpoints. As per screenshot

    enter image description here