Debug Tests in NG Test

前端 未结 5 706
我在风中等你
我在风中等你 2021-01-31 02:12

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?

5条回答
  •  北恋
    北恋 (楼主)
    2021-01-31 02:25

    Update for Angular version 9

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

    • In devtools, select the sources tab
    • Press CTRL + P
    • Type in the name of the file you want to debug

    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

提交回复
热议问题