Angular 9 - ????????????????

Posted

技术标签:

【中文标题】Angular 9 - 生成空的伊斯坦布尔测试覆盖率报告【英文标题】:Angular 9 - Istanbul test coverage report being generated empty 【发布时间】:2020-06-27 20:15:27 【问题描述】:

我收到一份空报告,它列出了文件,但没有填写百分比... 关于可能导致它的任何想法?

错误信息:

Handlebars:访问已被拒绝解析属性“语句”,因为它不是其父级的“自己的属性”。

我的 package.json 文件:

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

这是coverage/index.html文件中的结果

【问题讨论】:

首先你的 package.json 中有过时的依赖,尝试this 更新你的依赖。此外,您还可以发布您的 karma.config.js 吗? 嘿@YuriyKravets 感谢您的评论。你是对的,问题是 karma-coverage-istanbul-reporter 包已经过时了。在我执行以下 npm 更新语句“npm i -D karma-coverage-istanbul-reporter@2.1.1”后,它又开始工作了。谢谢 【参考方案1】:

包“karma-coverage-istanbul-reporter”已过期。 在我执行以下 npm 更新语句“npm i -D karma-coverage-istanbul-reporter@2.1.1”后,它又可以工作了。

【讨论】:

这让我很开心!

以上是关于Angular 9 - ????????????????的主要内容,如果未能解决你的问题,请参考以下文章

关于 Angular 9 迁移的 Angular 生产问题

安装nodejs后无法安装@angular/cli@9.1.8

Angular 9 - ????????????????

Angular 9 - 删除 Angular Material Stepper 上的默认图标(创建)

未检测到匹配的服务人员 - Angular 9

升级到 9.0 和 angular 7 后修复 angular-redux/store