nodejs - 如何检查代码的哪一部分通过单元测试进行了测试?

nodejs - How to check which portion of code is tested with unit tests?

我正在使用 tapeistanbul 在我的 Node.js 项目中编写单元测试,结果如下:

Statements   : 93.04% ( 107/115 )
Branches     : 86.84% ( 33/38 )
Functions    : 90% ( 27/30 )
Lines        : 93.86% ( 107/114 )

有没有办法找出哪些语句、函数或部分代码未经过测试?

根据文档,您应该在 ./coverage 下找到完整的 html 报告,逐行覆盖:

and this should produce a coverage.json, lcov.info and lcov-report/*html under ./coverage Sample of code coverage reports produced by this tool (for this tool!): HTML reports

文档:https://github.com/gotwarlost/istanbul#getting-started