Questions tagged [karma-coverage]

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

A plugin. Generate code coverage.

295 questions
0
votes
0 answers

Angular Unit testing with Jasmine / Karma

I'm trying to write a unit test script for custom directive with jasmine and karma. Current application is Angular 1.28; Issue is above code not running properly. Can anyone help/guide me that where i'm making mistake; or how to write unit test…
0
votes
2 answers

Javascript regex to match exact folder path

I have a folder structure like this: main |__Test |__Sub |__Match |__Match1 |__Match2 I have a requirement to: Match only one folder - "Match" Match multiple folder - "Match, Match1, Match2 For a) I've…
nishantcop
  • 977
  • 1
  • 8
  • 24
0
votes
1 answer

Intellij Karma coverage only showing statstics for tests

Following the IntelliJ instructions for Enabling running tests with coverage in Karma I'm able to run my karma tests successfully and view all my expected results in the generated coverage directory, however in IntelliJ's Coverge tab only my spec.js…
Thomas Kagan
  • 440
  • 3
  • 16
0
votes
1 answer

Exclude import files like angular.js, angular-ui-router.js, angular-mocks.js etc from Karma coverage reports

My coverage report includes the imports like : node_modules\angular-mocks\ | 26.09 | 11.58 | 19.7 | 27.23 | | angular-mocks.js | 26.09 | 11.58 | 19.7 | 27.23 |...…
0
votes
1 answer

How to Karma test Restangular http call using httpbackend to test both success and error cases?

I am testing an angular service using karma/jasmine and one of my service functions is as follows. I need to get coverage to 100%, but can't seem to figure out how to test both success and error cases.. function getAccount(accountId) { var defer…
noobprogrammer
  • 345
  • 1
  • 6
  • 20
0
votes
1 answer

Write TDD in angularjs karma and jasmine

I am writing the test cases of my application using karma and jasmine. I am new in unit testing. Here is my code: $scope.$watch('filterParams.statusModel', function() { $scope.customFilters.statusArray =…
Karan
  • 1,048
  • 2
  • 20
  • 38
0
votes
1 answer

How to get Karma coverage for the if else cases in controller method using Mocha / Jasmine?

I have the below controller method: function changeItem(itemList) { vm.selectedItem = ''; if(itemList !== null || itemList !== '' && itemList !== undefined){ if (itemList.guestFirstName !== '' && …
Smitha
  • 6,110
  • 24
  • 90
  • 161
0
votes
0 answers

Configure Unit Testing using Karma and Jasmine and code coverage using istanbul for an angular 2 app

Please find the link to the bitbucket repo below https://bitbucket.org/abhinav-cleo/harmonyangular2project its a public repo. the app is written using angular 2 and typescript. all the components are inside the app folder which are to be unit tested…
0
votes
0 answers

Publishing Karma result in sonar

I'm trying to publish karma report in sonar.Ours is a angularJS application Maven project.Already sonarqube is displaying junit code coverage.I have generated lcov.info file but sonarqube is not picking up the file.I have included following…
0
votes
1 answer

How to debug single Karma test using WebStorm

I am trying to debug single test using Karma and WebStorm. I found that this can be done, when I do not use coverage reporter and run karma.config with -- reporter progress, but this is not working changing it into fit in unit test. How to debug…
jmod999
  • 239
  • 3
  • 10
0
votes
2 answers

Istanbul instrumenter loader can not find source map for Angular2 component.

I'm trying to put up angular2 scaffolding using karma, jasmine, webpack by following various sources from online to get a deeper understanding. I'm using istanbul-instrumenter-loader for karma coverage reporting. When I run npm test I get following…
ksharifbd
  • 5,102
  • 2
  • 18
  • 23
0
votes
3 answers

How can I get code coverage results in my Aurelia app using karma?

I created an Aurelia app using the Aurelia CLI (au new) and would like to set up code coverage (preferably with karma-coverage, but if that's not possible I'll use whatever). I first npm install karma-coverage --save-dev then copy the test.js task…
lebolo
  • 2,120
  • 4
  • 29
  • 44
0
votes
1 answer

Karma + JSPM + Typescript - not found '.ts.js'

Mainly just trying to get Karma+JSPM to play nice on loading the .ts files but having absolutely no luck. I see up a discussion repo with a stripped down example. Basically JSPM within Karma is seemingly ignoring the defaultJSExtensions: true and…
Larchy
  • 163
  • 3
  • 10
0
votes
1 answer

Is Jasmine advise to reduce local variable or karma coverage report?

My Karma coverage report shows to cover the local variable. is that possible or its a karma-coverage report issue. Please have a look at the Angular Controller Code. 'use strict'; angular.module('moduleName') .controller('FormController', […
Alamelu Venkat
  • 471
  • 1
  • 4
  • 15
0
votes
1 answer

Karma-coverage always giving 404 not found response

I'm trying to make some unit-tests for my angular SPA. I made some with Karma, and they work pretty well, but then i decided to install karma-coverage to see tests coverage. And i already waste a lot of time trying to see this report. I installed…
tv1st
  • 39
  • 7