Code coverage with Mocha

后端 未结 3 1680
故里飘歌
故里飘歌 2020-12-07 06:55

I am using Mocha for testing my NodeJS application. I am not able to figure out how to use its code coverage feature. I tried googling it but did not find any proper tutoria

3条回答
  •  被撕碎了的回忆
    2020-12-07 07:16

    Blanket.js works perfect too.

    npm install --save-dev blanket

    in front of your test/tests.js

    require('blanket')({
        pattern: function (filename) {
            return !/node_modules/.test(filename);
        }
    });
    

    run mocha -R html-cov > coverage.html

提交回复
热议问题