0

我将我的项目从 Angular 6.4 更新到 Angular 7.1,现在运行脚本:ng test app-name --coverage给了我错误:

● Unrecognized CLI Parameters:

  Following options were not recognized:
  ["main", "polyfills", "tsConfig"]

  CLI Options Documentation:
  https://jestjs.io/docs/en/cli.html

angular.json 中测试命令的配置如下所示:

"test": {
  "builder": "@angular-builders/jest:run",
  "options": {
    "main": "apps/app-name/src/test.ts",
    "polyfills": "apps/app-name/src/polyfills.ts",
    "tsConfig": "apps/app-name/tsconfig.spec.json",
    "configPath": "./jest.config.json",
    "styles": [
      "apps/app-name/src/styles.scss"
    ],
    "scripts": [],
    "assets": [
      "apps/app-name/src/favicon.ico",
      "apps/app-name/src/assets"
    ]
  }
},

我应该如何更新配置以与 Angular 7 兼容?

4

1 回答 1

1

错误是我搬到 Jest 时忘记删除/替换旧的 karma-builder 配置。

显然 Angular 7 比 Angular 6 更好地检查了类似的东西(万岁!),所以我把它误认为是 Angular 或 Jest 错误。

于 2018-11-29T15:01:39.533 回答