<bdo id='jYv3m'></bdo><ul id='jYv3m'></ul>
    <i id='jYv3m'><tr id='jYv3m'><dt id='jYv3m'><q id='jYv3m'><span id='jYv3m'><b id='jYv3m'><form id='jYv3m'><ins id='jYv3m'></ins><ul id='jYv3m'></ul><sub id='jYv3m'></sub></form><legend id='jYv3m'></legend><bdo id='jYv3m'><pre id='jYv3m'><center id='jYv3m'></center></pre></bdo></b><th id='jYv3m'></th></span></q></dt></tr></i><div id='jYv3m'><tfoot id='jYv3m'></tfoot><dl id='jYv3m'><fieldset id='jYv3m'></fieldset></dl></div>
  • <small id='jYv3m'></small><noframes id='jYv3m'>

      <legend id='jYv3m'><style id='jYv3m'><dir id='jYv3m'><q id='jYv3m'></q></dir></style></legend>

      <tfoot id='jYv3m'></tfoot>

        如何更改 Karma 执行的 LCOV 报告的格式?

        How to change the format of the LCOV report executed by Karma?(如何更改 Karma 执行的 LCOV 报告的格式?)
          <tbody id='Xbpk6'></tbody>
        <i id='Xbpk6'><tr id='Xbpk6'><dt id='Xbpk6'><q id='Xbpk6'><span id='Xbpk6'><b id='Xbpk6'><form id='Xbpk6'><ins id='Xbpk6'></ins><ul id='Xbpk6'></ul><sub id='Xbpk6'></sub></form><legend id='Xbpk6'></legend><bdo id='Xbpk6'><pre id='Xbpk6'><center id='Xbpk6'></center></pre></bdo></b><th id='Xbpk6'></th></span></q></dt></tr></i><div id='Xbpk6'><tfoot id='Xbpk6'></tfoot><dl id='Xbpk6'><fieldset id='Xbpk6'></fieldset></dl></div>

          <small id='Xbpk6'></small><noframes id='Xbpk6'>

          1. <tfoot id='Xbpk6'></tfoot>

                • <bdo id='Xbpk6'></bdo><ul id='Xbpk6'></ul>
                • <legend id='Xbpk6'><style id='Xbpk6'><dir id='Xbpk6'><q id='Xbpk6'></q></dir></style></legend>

                • 本文介绍了如何更改 Karma 执行的 LCOV 报告的格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我已将 Karma 配置为报告我的 JavaScript 代码的覆盖率.以下是 karma.conf.js 文件中的部分配置:

                  I've configured Karma to report the coverage of my JavaScript code. Here is the part of the configuration in the karma.conf.js file:

                  coverageReporter: {
                    reporters: [
                      {
                        type: 'html',
                        dir: 'build/karma/coverage'
                      },
                      {
                        type: 'lcov',
                        dir: 'build/karma/coverage',
                        subdir: '.'
                      },
                      {
                        type: 'cobertura',
                        dir: 'build/karma/coverage'
                      }
                    ]
                  },
                  

                  我的 lcov.info 文件格式如下:

                  My lcov.info file has the following format:

                  TN:
                  SF:./app/scripts/app.js
                  FN:16,(anonymous_1)
                  FN:26,(anonymous_2)
                  FNF:2
                  FNH:1
                  FNDA:1,(anonymous_1)
                  FNDA:0,(anonymous_2)
                  DA:2,1
                  DA:20,1
                  DA:29,0
                  DA:34,0
                  LF:4
                  LH:2
                  BRF:0
                  BRH:0
                  end_of_record
                  

                  很遗憾,Sonarqube JavaScript 插件 只考虑以 SF: 开头的行,DA:BRDA:(参见 LCOVParser).

                  Unfortunately, the Sonarqube JavaScript plugin only considers the lines that start with SF:, DA: or BRDA: (cf LCOVParser).

                  因此,LCOV HTML 报告(由伊斯坦布尔制作)在相同数据上为我提供了比 Sonar 更高的代码覆盖率.

                  Due to that, the LCOV HTML report (made by Istanbul) gives me a higher code coverage than Sonar on the same data.

                  有没有办法改变生成的lcov.info的格式?

                  Is there a way to change the format of the lcov.info generated?

                  如果我查看伊斯坦布尔代码,我可以想象不同的标签:

                  If I look in Istanbul code, I can imagine the meaning of the different labels:

                  • BRFBRHBRDA 用于分支.
                  • FNFNFFNHFNDA 用于函数.
                  • LNLFLH 用于.
                  • *F为总数,*H为覆盖信息.
                  • BRF, BRH, BRDA are for branches.
                  • FN, FNF, FNH, FNDA are for functions.
                  • LN, LF, LH are for lines.
                  • *F is the total, while *H is the covered information.

                  Istanbul 和 Sonar 覆盖范围之间的差异似乎是由于后者完全忽略了 Functions 和 Branches 覆盖范围.

                  The difference between the Istanbul and Sonar coverage seems to be due to the fact that the latter completely ignores the Functions and Branches coverage.

                  有什么办法解决这个问题吗?

                  Any idea to solve that?

                  推荐答案

                  您可以运行以下脚本:cat lcov.info |egrep "^(SF|DA|BRDA):" >lcov.info.new;mv lcov.info.new lcov.info.

                  You could run a script that does: cat lcov.info | egrep "^(SF|DA|BRDA):" > lcov.info.new; mv lcov.info.new lcov.info.

                  我得到了:

                  SF:./app/scripts/app.js
                  DA:2,1
                  DA:20,1
                  DA:29,0
                  DA:34,0
                  

                  这篇关于如何更改 Karma 执行的 LCOV 报告的格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  quot;Status Code:200 OK (from ServiceWorker)quot; in Chrome Network DevTools?(“状态码:200 OK(来自 ServiceWorker)在 Chrome 网络开发工具中?)
                  How to set a header for a HTTP GET request, and trigger file download?(如何为 HTTP GET 请求设置标头并触发文件下载?)
                  Adding custom HTTP headers using JavaScript(使用 JavaScript 添加自定义 HTTP 标头)
                  SQL Query DocumentDB in Azure Functions by an integer not working(通过整数在 Azure Functions 中 SQL 查询 DocumentDB 不起作用)
                  Azure Functions [JavaScript / Node.js] - HTTP call, good practices(Azure Functions [JavaScript/Node.js] - HTTP 调用,良好实践)
                  Azure Functions - Import Custom Node Module(Azure Functions - 导入自定义节点模块)
                      <i id='RNvqC'><tr id='RNvqC'><dt id='RNvqC'><q id='RNvqC'><span id='RNvqC'><b id='RNvqC'><form id='RNvqC'><ins id='RNvqC'></ins><ul id='RNvqC'></ul><sub id='RNvqC'></sub></form><legend id='RNvqC'></legend><bdo id='RNvqC'><pre id='RNvqC'><center id='RNvqC'></center></pre></bdo></b><th id='RNvqC'></th></span></q></dt></tr></i><div id='RNvqC'><tfoot id='RNvqC'></tfoot><dl id='RNvqC'><fieldset id='RNvqC'></fieldset></dl></div>
                        <tbody id='RNvqC'></tbody>
                      <legend id='RNvqC'><style id='RNvqC'><dir id='RNvqC'><q id='RNvqC'></q></dir></style></legend>

                      <tfoot id='RNvqC'></tfoot>
                          <bdo id='RNvqC'></bdo><ul id='RNvqC'></ul>
                          • <small id='RNvqC'></small><noframes id='RNvqC'>