Code coverage for angular 2

后端 未结 4 1350
孤独总比滥情好
孤独总比滥情好 2021-02-02 15:44

How do you find the code coverage for angular 2 code? Is there any plugin for vs code editor or webstorm that I can use? I am using Jasmine and Karma for unit testing of my code

4条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-02 16:18

    I struggled with this one. The solution I found was

    ng test --code-coverage
    

    But make sure that in your karma.conf.js file, you have a reporter specified (I use 'coverage-istanbul')

    e.g. reporters: ['coverage-istanbul']

    The coverage report will be in a directory called 'coverage' in your root directory.

提交回复
热议问题