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/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


回答1:


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



来源:https://stackoverflow.com/questions/60710690/angular-9-istanbul-test-coverage-report-being-generated-empty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!