Angular 9 - Istanbul test coverage report being generated empty
Asked Answered
T

1

4

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/platform-browser": "^9.0.4",
    "@angular/platform-browser-dynamic": "^9.0.4",
    "@angular/router": "^9.0.4",
    "@fullcalendar/core": "^4.4.0",
    "chart.js": "^2.9.2",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.5.7",
    "font-awesome": "^4.7.0",
    "karma-coverage": "^1.1.1",
    "karma-phantomjs-launcher": "^1.0.4",
    "moment-timezone": "^0.5.17",
    "ngx-clipboard": "^12.2.1",
    "primeicons": "^2.0.0",
    "primeng": "^9.0.0",
    "quill": "^1.3.7",
    "rxjs": "^6.5.3",
    "tslib": "^1.10.0",
    "web-animations-js": "^2.3.2",
    "xlsx": "^0.15.1",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.900.4",
    "@angular/cli": "^9.0.4",
    "@angular/compiler-cli": "^9.0.4",
    "@angular/language-service": "^9.0.4",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "^12.11.1",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^4.4.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.4.3",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.1",
    "ts-node": "~7.0.1",
    "tslint": "~5.11.0",
    "typescript": "~3.7.5"

And here are the results in coverage/index.html file

Coverage results

Tandie answered 16/3, 2020 at 17:39 Comment(2)
first of all you have outdated dependencies in your package.json, try this to update your dependencies. Additionally, can you also post your karma.config.js?Kahlil
Hey @YuriyKravets thanks for your comment. you were right, the problem was the karma-coverage-istanbul-reporter package that was out-of-date. After I execute the following npm update statement "npm i -D [email protected]", it is working again. Thank youTandie
T
12

The package "karma-coverage-istanbul-reporter" was out-of-date. After I execute the following npm update statement "npm i -D [email protected]", it is working again.

Tandie answered 17/3, 2020 at 13:50 Comment(1)
this made my day!Oecology

© 2022 - 2024 — McMap. All rights reserved.