question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Karma Coverage Report shows always 100% coverage of nothing

See original GitHub issue
  • Please follow the issue template below for bug reports and feature requests.
  • Tickets opened without any of these informations will be closed without any explanation.
Overview of the issue

After generating a jhipster gateway with Angular 2 frontend and starting the Karma Unit-Tests the coverage report shows 100% of everything and no files. That can’t be right, because initially there is only one Karma-Unit-Test present.

Motivation for or Use Case

Coverage report is not very useful this way.

Reproduce the error

Generate a Gateway with Angular 2.

Related issues
Suggest a Fix
JHipster Version(s)

At least 4.0.3 and 4.0.5

JHipster configuration
JHipster configuration, a .yo-rc.json file generated in the root folder
{
  "generator-jhipster": {
    "jhipsterVersion": "4.0.3",
    "baseName": "person",
    "packageName": "com.diamos.person",
    "packageFolder": "com/diamos/person",
    "serverPort": "51286",
    "authenticationType": "jwt",
    "hibernateCache": "ehcache",
    "clusteredHttpSession": false,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Memory",
    "prodDatabaseType": "postgresql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": "eureka",
    "buildTool": "gradle",
    "enableSocialSignIn": false,
    "jwtSecretKey": "14b70ac02ed21d1be0d0f7608754c21cdfd9be21",
    "useSass": true,
    "clientPackageManager": "npm",
    "applicationType": "gateway",
    "clientFramework": "angular2",
    "testFrameworks": [
      "protractor"
    ],
    "jhiPrefix": "jhi",
    "enableTranslation": true,
    "nativeLanguage": "de",
    "languages": [
      "de",
      "en"
    ]
  }
}
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System

java version “1.8.0_121” Java™ SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot™ 64-Bit Server VM (build 25.121-b13, mixed mode)

git version 1.8.4.msysgit.0

node: v6.9.5

npm: 3.10.10

yeoman: 1.8.5

yarn: 0.19.1

  • Checking this box is mandatory (this is just to show you read everything)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
kaidohallikcommented, Apr 25, 2017

FYI. I discovered additional case when coverage is always 100%: if project path contains substring test. It’s probably caused by this line https://github.com/jhipster/generator-jhipster/blob/master/generators/client/templates/angular/src/test/javascript/_karma.conf.js#L87

0reactions
colas-pomiescommented, Apr 25, 2017

@kaidohallik Thank you a lot. I got a problem since 2 days and can’t solve it.

I test all my project in GitLab CI but I got 100% 0/0 during the coverage step.

I try to reproduce this issue in local with the same docker has CI but the coverage was OK.

My project’s name was test-jhipster so during the CI it’s was cloning it in test-jhipster/ directory and coverage don’t pass. In local I mount myself the project in /home/jhipster/app so there was no test in the path and the coverage pass.

I rename my gitlab project and now the coverage is OK.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Karma coverage always showing 100% vue #360 - GitHub
Hi! I can't seem to get my coverage to show correctly, but the unit tests are running as they should. The coverage always...
Read more >
karma coverage shows 0/0, 100% coverage - Stack Overflow
i found a few links pointing to bug reports and documentation but none helped. here is my config file module.exports = function (config)...
Read more >
Verifying Code Coverage With Karma | The Stroz
Put simply, checking 'coverage' means we analyze our code and verify that every bit of it is covered by tests. That may seem...
Read more >
Find out how much code you're testing - Angular
Code coverage reports show you any parts of your code base that might not be properly tested by your unit tests. If you'd...
Read more >
Troubleshooting Code Coverage - Visual Studio (Windows)
In this article. What you should see; Possible reasons for seeing no results or old results; Some code is always shown as not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found