istanbul

How do you use Istanbul Code Coverage with transpiled Typescript?

你。 提交于 2019-12-03 05:31:57
问题 I've been reading articles on this all morning trying to get my environment setup correctly. But for some reason I'm not getting it. My setup- /app ... source (mixed js and ts) /scripts ... copied source (js) typescripts.js // transpiled typescript with inline mapping Tests run fine, and with the mapping debugging in the chrome debugger is mapped correctly. But Istanbul sees the typescripts.js file as one file instead of the concatenation of dozens of other files. To generate the typescript

Blanket.js vs Istanbul-js vs JSCover

核能气质少年 提交于 2019-12-03 04:15:51
I am trying to decide on a JS test code coverage tool but cannot see clearly the differences between them. The top hits in Google are blanket.js, istanbul-js and JSCover. Can anyone offer any information on the key differences between them and advantages/disadvantages? Are there any other useful ones out there? After some trying around i clearly find istanbul the most convenient tool to bring coverage analysis to a node-js project. its installed with npm install it sets up its behavior via the .istanbul.yml gets invoked by its own executable it provides multiple report formats such as clover,

Code Coverage for Typescript using karma-jasmine and istanbul

走远了吗. 提交于 2019-12-03 02:54:19
I am trying to get the Code Coverage for my typescript Code in karma framework using Istanbul in karma.conf typescript files are included and by karma typescript-preprocessor we able to do unit testing and code coverage of the typescript code but Code coverage report come for trans piled JavaScript code How can I get the coverage report for typescript code? Here is my karma.conf file. module.exports = function(config) { config.set({ // base path, that will be used to resolve files and exclude basePath: '', // frameworks to use frameworks: ['jasmine'], preprocessors: { 'src/**/*.ts': [

SonarQube Analysis not showing code coverage

泄露秘密 提交于 2019-12-02 08:10:56
I have a Jenkins project to do SonarQube analysis of my NodeJS project. I added istanbul as a dependency to my project's package.json . In the Jenkins build configuration, first I run a shell script: cd ./project-name npm install node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha path-to-unit-tests node_modules/.bin/istanbul report cobertura cd .. This installs the dependencies, runs the tests and generates a code coverage report and generates a cobertura-coverage.xml file. After the shell script, I run a Invoke Standalone SonarQube Analysis with the following properties for code

Istanbul gives me coverage but ends output with an error

主宰稳场 提交于 2019-11-30 19:23:37
I'm testing out a simple application (from the Mocha tutorial code here https://marcofranssen.nl/using-mocha-chai-sinon-to-test-node-js/ ) to try to get Istanbul to work. My problem is that Istanbul works fine to give me a coverage summary, but then spits out an error for some reason and I'm not sure why. My tests all pass so they're hopefully not the problem. Here is how I run Istanbul: $ istanbul cover test.js ============================================================================= Writing coverage object [C:\Users\path\test\coverage\coverage.json] Writing coverage reports at [C:\Users

前端精准测试探索:覆盖率实时统计工具

戏子无情 提交于 2019-11-30 09:37:50
背景 随着业务增长, 随之而来的前端需求激增, 如何在有限的时间内保证前端代码的质量. 通过测试同学单方面的保障, 还是免不了前端线上问题, 存在回归不到位或者测试遗漏的地方, 同时测试质量的高低没有客观数据可量化.<br> 通过单测方法补充, 可以提前发现一部分问题, 减少问题解决的成本, 但是由于业务形态的原因, 需求变更频繁, 功能迭代快, 补充和维护单测的成本比较高, 在业务方的大部分前端工程中暂时没有单测方法, 因此开发在自测时, 感知比较薄弱, 无量化数据, 在项目提测前也没有统一指标可以把关, 测试对开发的自测状况也不了解;<br> 同时前端缺少像jacoco这样的集成测试覆盖率统计框架, 无法通过集成测试收集覆盖率, 对于测试阶段的质量仍然没有数据量化 结合上面说的几点, 我们提出了前端集成测试覆盖率统计工具的需要, 以此来提升开发自测质量以及项目提测质量, 同时帮助补充回归不到位或测试遗漏的场景, 提升上线质量. 技术选型 首先, 覆盖率收集的前提, 需要完成代码插桩工作, 插桩方法来自于两个开源覆盖率统计框架, istanbul.js以及istanbul-middleware (以下称im) , 提供了若干个插桩方法, 而im其实也是在istanbul.js的基础上做了封装, 能力来自于istanbul-lib-instrument 所有的插桩方法,

Jest: Ignore lines for code coverage

纵然是瞬间 提交于 2019-11-30 08:00:55
In Jest, is there any way to ignore code for test coverage? I tried using /* istanbul ignore next */ But it doesn't seem to work. ilyar It works. (function(global) { var defineAsGlobal = true; /* istanbul ignore next */ if(typeof exports === 'object') { module.exports = lib; defineAsGlobal = false; } /* istanbul ignore next */ if(typeof modules === 'object' && typeof modules.define === 'function') { modules.define('lib', function(provide) { provide(lib); }); defineAsGlobal = false; } /* istanbul ignore next */ if(typeof define === 'function') { define(function(require, exports, module) {

Istanbul gives me coverage but ends output with an error

限于喜欢 提交于 2019-11-30 03:15:15
问题 I'm testing out a simple application (from the Mocha tutorial code here https://marcofranssen.nl/using-mocha-chai-sinon-to-test-node-js/) to try to get Istanbul to work. My problem is that Istanbul works fine to give me a coverage summary, but then spits out an error for some reason and I'm not sure why. My tests all pass so they're hopefully not the problem. Here is how I run Istanbul: $ istanbul cover test.js =============================================================================

Jest: Ignore lines for code coverage

北慕城南 提交于 2019-11-29 10:48:46
问题 In Jest, is there any way to ignore code for test coverage? I tried using /* istanbul ignore next */ But it doesn't seem to work. 回答1: It works. (function(global) { var defineAsGlobal = true; /* istanbul ignore next */ if(typeof exports === 'object') { module.exports = lib; defineAsGlobal = false; } /* istanbul ignore next */ if(typeof modules === 'object' && typeof modules.define === 'function') { modules.define('lib', function(provide) { provide(lib); }); defineAsGlobal = false; } /*

SonarQube and Lcov report Could not resolve file paths

纵然是瞬间 提交于 2019-11-29 07:23:25
We are trying to make a SonarQube code coverage report for our angular application. We have used Karma to generate a code coverage report and import it into SonarQube analyzer. The SonarQube already has C# coverage for our project, now we want to add JavaScript code coverage as well. Teamcity calls, Karma and it creates a code coverage and put the lcov file and report files into src\Planning.Spa\Coverage\report folder. LCOV File TN: SF:E:/a03/work/bb52cb33e083fc9/src/Planning.Spa/Offer/app/app.component.js FN:5,(anonymous_1) FN:6,AppComponent FN:8,(anonymous_3) FN:9,(anonymous_4) Teamcity has