Questions tagged [karma-coverage]

A plugin for Karma (code test runner) that generate code coverage.

A plugin. Generate code coverage.

295 questions
6
votes
4 answers

Angular4 how to enable test coverage

I am working on an Angular4 project. I am trying to set up code coverage. I created a very simple and small app. I read every possible page I could find, but I am lost. How do I set up code coverage in Angular4? UPDATE2: I have now decided to use…
Uwe
  • 385
  • 6
  • 18
6
votes
2 answers

Testing observable object angular 2 karma

I'm working on my unit test cases for Angular 2 with Karma, I got stuck with one of a function where I run the test for below line expect(component.subscribeToEvents()).toBeTruthy(); and I view my coverage code, the lines inside the test file…
6
votes
1 answer

Asking about the Coverage summary in Unit test of angular 2?

When I run test in angular 2 and I see a few keywords output on console command in Coverage Summary section as Statements, Branches, Functions.... And I don't know exactly what is it? Any help explain this for me, thank you.
dangchithao
  • 613
  • 2
  • 8
  • 24
6
votes
2 answers

Karma-Coverage Report Shows Code As Covered (which is obviously not covered)

I a trying to generate an HTML coverage report, but it does not contain the output I expect. Maybe I'm wrong here, but it should show only those lines and methods covered which are called from the spec file, right? Somehow it does not. Update: I…
gearsdigital
  • 13,915
  • 6
  • 44
  • 73
6
votes
1 answer

node.js istanbul and jasmine setup

I am unable to get istanbul to work with jasmine: Here is my directory structure ttm-jira - package.json - spec - jira-spec.js My package.json looks like this: { "name": "ttm-jira", "version": "1.0.0", "description": "nodeJS…
Rookie
  • 5,179
  • 13
  • 41
  • 65
6
votes
3 answers

Karma JS -- How to Include all All Sources?

I have a +10K lines Backbone Marionette app and we are running tests and coverage through Karma. I would like to include all the sources so that we can have a better idea of what it is not covered by our tests. I have been passing the…
Hugo
  • 6,244
  • 8
  • 37
  • 43
5
votes
1 answer

Angular library secondary entrypoint test code coverage problem

I am using angular library with secondary entrypoint My library folder structure is my-library secondary-entrpoint 1 service 1 secondary-entrypoint 2 service 2 src And I used this command ng test my-library --code-coverage The secondary…
5
votes
0 answers

Chrome Headless 83.0.4103.116 (Linux x86_64) ERROR Disconnected, because no message in 30000 ms., Angular 8

I have 746 test cases, but when i am trying to run the test cases using the command below: "ng test --browsers='CustomChromeHeadless' --code-coverage=true --watch=false --source-map=false", it gives error as below, after executing some random…
5
votes
1 answer

Expected one matching request, found 2 requests. How do I test for 2 requests

I am working on an Angular application and I am using Jasmine to test the application. What I want is to test for two similar HTTP requests in one method such as, ngOnInit() . I have an HTTP request that is called twice in ngOnInit() method…
Saurabh Gupta
  • 315
  • 1
  • 5
  • 14
5
votes
1 answer

Is there a way to process Karma - Angular unit tests in batches?

We are facing an issue where our tests will start failing or running extremely slow after a certain point. I have seen articles online where others too are facing issues. The primary reason for those failures are memory consumed by browsers while we…
5
votes
1 answer

"ng test" can't do coverage report and TeamCity reporting at the same time

I'm trying to run unit tests for an Angular CLI project on a TeamCity build server. If I use the command: ng test --single-run --code-coverage then, as expected, I get a test coverage report but the individual test results don't show up in…
5
votes
1 answer

Karma config to exclude nested directories

I am using karma for unit testing my angular 2 application. I have following directory structure - └── src/ ├── index.js ├── index.js.text ├── index.test.js ├── README.txt ├── startuptest.js ├── lib/ | ├── util.js |…
5
votes
2 answers

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

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.
5
votes
0 answers

Karma Code Coverage Incorrect with Webpack

I am currently using Karma as my test runner with Webpack. I've noticed that simple test files which contain no tests give me 92.86% statement coverage, 50% branch coverage, 100% function coverage, and 92.86% line coverage. describe('tests.js',…
Brandon Parker
  • 762
  • 7
  • 18
5
votes
1 answer

Karma coverage fails to show correct results

I need some help regarding Karma with browserify coverage. I created a repo with the test I am running in here: https://github.com/jotaoncode/web-istanbul The results on my coverage are the following: Results of coverage The test only runs over the…
juan garcia
  • 1,326
  • 2
  • 23
  • 56
1 2
3
19 20