karma-coverage

How to measure common coverage for Polymer components + .js files?

落花浮王杯 提交于 2019-12-09 06:54:52
问题 How to measure common coverage for Polymer components with all .js files in solution (for non-component tests QUnit is used)? I tried karma-coverage, but it works only for .js files. 回答1: For Polymer, you would normally use web-component-tester (WCT) to test your components, and the web-component-tester-istanbul plugin for code coverage. You'd configure wct.conf.json in the root of your project with something like this: { "suites": [ "test/components/my-view1/my-view1.html" ], "plugins": {

Sonarqube does not retrieve my JavaScript coverage from LCOV

风流意气都作罢 提交于 2019-12-07 13:08:38
问题 I have an application with the following structure: my-application +- pom.xml +- app | +- scripts | | +- app.js | | +- **/*.js | +- 3rd-party-libs +- build +- node_modules +- test I've create the pom.xml only to run the SonarQube analysis. Otherwise, all the tasks are run by Grunt (tests are run with Karma). The content of the pom.xml is the following: <properties> <sonar.language>js</sonar.language> <sonar.sourceEncoding>UTF-8</sonar.sourceEncoding> <sonar.javascript.coveragePlugin>lcov<

Sonarqube does not retrieve my JavaScript coverage from LCOV

拜拜、爱过 提交于 2019-12-05 19:46:27
I have an application with the following structure: my-application +- pom.xml +- app | +- scripts | | +- app.js | | +- **/*.js | +- 3rd-party-libs +- build +- node_modules +- test I've create the pom.xml only to run the SonarQube analysis. Otherwise, all the tasks are run by Grunt (tests are run with Karma). The content of the pom.xml is the following: <properties> <sonar.language>js</sonar.language> <sonar.sourceEncoding>UTF-8</sonar.sourceEncoding> <sonar.javascript.coveragePlugin>lcov</sonar.javascript.coveragePlugin> <sonar.javascript.lcov.reportPath>build/karma/coverage/lcov.info</sonar

Getting Karma, 6to5ify and Istanbul to play ball

醉酒当歌 提交于 2019-12-05 05:08:40
I have Browserify, 6to5ify and Karma to play nice, successfully running my specs. When I add code coverage however, things go south. I've tried several approaches: Add browserify-istanbul transform to my karma.conf.js. However, this results in it trying to run instrumentation on my spec-files as well it would appear. Run coverage preprocessor on my source files. But because istanbul (even douglasduteil/karma-coverage#next ) doesn't read my 6to5ify browserify transform, this crashes immediately on the first file it tries to parse (because of the import statement), or when I use karma-coverage

Sonarqube default coverage to 0 from Karma Coverage LCOV file with absolute pathjs

ぃ、小莉子 提交于 2019-12-04 20:21:36
Sonar does not retrieve the coverage information for my project when paths are absolute in my lcov file. For the file: TN: SF:/mnt/vg01-data01/jenkins/<jenkins.myhost.com>/jenkins_home/workspace/<job1>/src/app.js FN:,(anonymous_0) FN:,(anonymous_1) FNF:2 FNH:2 FNDA:1,(anonymous_0) FNDA:2,(anonymous_1) DA:3,1 DA:4,1 DA:6,1 DA:7,1 DA:8,1 DA:9,1 DA:11,1 DA:18,1 DA:19,1 DA:22,2 DA:27,1 LF:11 LH:11 BRF:0 BRH:0 end_of_record .... I get the following warnings: ... 05:06:27.565 INFO: Analysing [/srv/jenkins/<jenkins.myhost.com>/jenkins_home/workspace/<job1>/coverage/lcov.info] 05:06:27.574 DEBUG:

Branches on constructor not covered

一笑奈何 提交于 2019-12-04 19:13:08
问题 I am creating my unit tests with Jasmine and I have a question about the branch covered. Does anyone know why the code part shows that the branches are not covered as we can see below? This is the unit test: describe('MyComponent', () => { let component: MyComponent; let fixture: ComponentFixture<MyComponent>; let myService: MyService; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ MyComponent ], imports: [ MaterializeModule, FormsModule, ReactiveFormsModule,

How to change the format of the LCOV report executed by Karma?

∥☆過路亽.° 提交于 2019-12-03 18:46:50
问题 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' } ] }, 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

How to do code coverage with karma, typescript, and browserify

帅比萌擦擦* 提交于 2019-12-03 15:16:48
问题 How do you setup karma test runner to generate code coverage reports of a typescript project? Given the following folder structure and karma.conf.js file I'm already using karma to run my tests written in TypeScript. I already fiddled around with karma-coverage and remap-istanbul but without any luck yet. If possible I'd like to do it without any additional npm scripts . . ├── karma.conf.js ├── package.json ├── src │ └── add.ts ├── test │ └── addSpec.ts ├── tsconfig.json ├── typings │ ├──

Branches on constructor not covered

我是研究僧i 提交于 2019-12-03 12:25:31
I am creating my unit tests with Jasmine and I have a question about the branch covered. Does anyone know why the code part shows that the branches are not covered as we can see below? This is the unit test: describe('MyComponent', () => { let component: MyComponent; let fixture: ComponentFixture<MyComponent>; let myService: MyService; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ MyComponent ], imports: [ MaterializeModule, FormsModule, ReactiveFormsModule, HttpModule ], providers: [ MyService, FormBuilder ] }) .compileComponents(); })); beforeEach(() => { fixture

Code Coverage for Typescript using karma-jasmine and istanbul

*爱你&永不变心* 提交于 2019-12-03 12:23:45
问题 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