一个简单的工具脚本,用于将istanbul生成的coverage信息添加到项目的README.md
- 安装
npm install --save-dev coverage-to-readme
2. 在README.md需要添加单元测试覆盖率的地方打个标
\```coverage #前面的\不要哦
\```
-
运行
istanbul cover
生成信息文件 -
运行命令
node node_modules/coverage-to-readme
指定不同格式,如 text
, text-summary
, 默认为text-summary
node node_modules/coverage-to-readme --report text
指定不同的coverage信息目录,会传递给istanbul report --root
默认的ouput为README.md,可以修改成需要的文件