IT技术博客大学习 共学习 共进步

标签:Uncoverage

共 1 篇相关文章

IT 浏览 1,600

JSCoverage 的一个 Uncoverage

上班途中想到的,到公司后一测,果然如此。看 test.js: function testFn(a, b, c) { var ret = 0; if(a || b || c) { ret++; } return ret; } testFn(1); JSCoverage 覆盖率 100%:jscoverage.html?test.html 实际上,testFn(0, 1); testFn(0, 0, 1); 等情形都没覆盖到。原因很简单, if 语句中存在或,但 jscoverage 生成的代码,是以代码行为单位的