karma-coverage

ng test --code-coverage not printing coverage details

ⅰ亾dé卋堺 提交于 2020-12-13 04:09:23
问题 When I run the tests using ng test --code-coverage I get the code coverage as unknown, not sure what might be going wrong. Any help here is appreciated. > ng test --code-coverage 10% building modules 1/1 modules 0 active26 06 2018 11:00:51.088:WARN [karma]: No captured browser, open http://localhost:9876/ 26 06 2018 11:00:51.095:INFO [karma]: Karma v2.0.0 server started at http://0.0.0.0:9876/ 26 06 2018 11:00:51.095:INFO [launcher]: Launching browser Chrome with unlimited concurrency 26 06

ng test --code-coverage not printing coverage details

不羁岁月 提交于 2020-12-13 04:03:09
问题 When I run the tests using ng test --code-coverage I get the code coverage as unknown, not sure what might be going wrong. Any help here is appreciated. > ng test --code-coverage 10% building modules 1/1 modules 0 active26 06 2018 11:00:51.088:WARN [karma]: No captured browser, open http://localhost:9876/ 26 06 2018 11:00:51.095:INFO [karma]: Karma v2.0.0 server started at http://0.0.0.0:9876/ 26 06 2018 11:00:51.095:INFO [launcher]: Launching browser Chrome with unlimited concurrency 26 06

Angular 9 - Istanbul test coverage report being generated empty

醉酒当歌 提交于 2020-08-05 15:23:46
问题 I'm getting an empty report, it's listing the files but it's not filling up the percentages... Any idea on what can be causing it? Error message: Handlebars: Access has been denied to resolve the property "statements" because it is not an "own property" of its parent. My package.json file: "dependencies": { "@angular/animations": "^9.0.4", "@angular/cdk": "^9.1.0", "@angular/common": "^9.0.4", "@angular/compiler": "^9.0.4", "@angular/core": "^9.0.4", "@angular/forms": "^9.0.4", "@angular

Angular 9 - Istanbul test coverage report being generated empty

一个人想着一个人 提交于 2020-08-05 15:23:34
问题 I'm getting an empty report, it's listing the files but it's not filling up the percentages... Any idea on what can be causing it? Error message: Handlebars: Access has been denied to resolve the property "statements" because it is not an "own property" of its parent. My package.json file: "dependencies": { "@angular/animations": "^9.0.4", "@angular/cdk": "^9.1.0", "@angular/common": "^9.0.4", "@angular/compiler": "^9.0.4", "@angular/core": "^9.0.4", "@angular/forms": "^9.0.4", "@angular

Code Coverage report shown only for polyfills.ts and test.ts under Dev\ folder. Doest show coverage for files under src folder

你说的曾经没有我的故事 提交于 2020-06-09 07:08:06
问题 In my angular 7 app, when i run "ng test --watch=false --code-coverage true" i get the coverage report in my coverage folder, but coverage is shown only for two files. (Polyfills.ts & test.ts). Below is my project structure. Please let me know how to get coverage for files under SRC folder. Note: when i run ng test all the tests under SRC folder is getting executed. dev --app --test.ts --tsconfig.app.json --tsconfig.spec.json src --lib --component --services angular.json karma.conf.json test

How to unit test model interfaces in typescript?

江枫思渺然 提交于 2020-05-13 05:25:37
问题 export interface User { name: string; } How can I unit test the above interface, so Karma could show it in the code coverage report? I already tried creating the object and assert some properties, but didn't work. The test passes but karma doesn't consider it in the code coverage report. import { User } from "./user"; describe('User', () => { it('test', () => { const obj: User = { name: "xxx", } expect(obj.name).toEqual("xxx"); }); }); 回答1: You can't. There is no code to cover here: nothing

How to unit test model interfaces in typescript?

廉价感情. 提交于 2020-05-13 05:24:39
问题 export interface User { name: string; } How can I unit test the above interface, so Karma could show it in the code coverage report? I already tried creating the object and assert some properties, but didn't work. The test passes but karma doesn't consider it in the code coverage report. import { User } from "./user"; describe('User', () => { it('test', () => { const obj: User = { name: "xxx", } expect(obj.name).toEqual("xxx"); }); }); 回答1: You can't. There is no code to cover here: nothing

How to unit test model interfaces in typescript?

好久不见. 提交于 2020-05-13 05:24:30
问题 export interface User { name: string; } How can I unit test the above interface, so Karma could show it in the code coverage report? I already tried creating the object and assert some properties, but didn't work. The test passes but karma doesn't consider it in the code coverage report. import { User } from "./user"; describe('User', () => { it('test', () => { const obj: User = { name: "xxx", } expect(obj.name).toEqual("xxx"); }); }); 回答1: You can't. There is no code to cover here: nothing

LCOV.INFO has absolute path for SF

最后都变了- 提交于 2020-01-14 06:17:28
问题 I need to have relative path as value of SF: parameter in the lcov.info file generated by karma coverage. This is to enable SonarQube to gather the info to display the coverage. Currently, the SF parameter is having complete absolute path , e.g. c:\abc\xyz....\src\bar\foo.js I need to have SF: src\bar\foo.js Is there a way to achieve this? 回答1: Unfortunately it is still impossible out of the box. To fix the issue you can either: use istanbul merged with this request, process the output file

Unexpected token while running karma-coverage on Typescript project

删除回忆录丶 提交于 2020-01-13 07:52:25
问题 I have a basic Angular/Typescript project with 12 rudimentary unit tests that run perfectly fine. Now I would like to get the coverage for these tests. I tried various approaches, and none of them worked, so I decided to start over with karma-coverage and ask for help here. :-) Currently, when I run karma, I get an error message for every single source file that looks like this: Failed to parse file: C:/Users/FRBA/Documents/MyProject/src/app/nav/new-panel/new-panel.component.ts 07 07 2017 07