Angular:从 Karma 移动到 Jest 后,错误 "Unrecognized CLI Parameters"
Angular: after moving from Karma to Jest, Error "Unrecognized CLI Parameters"
我将我的项目从 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 兼容?
错误是我在转移到 Jest 时忘记了 remove/replace 旧的 karma-builder 配置。
显然 Angular 7 检查类似的东西比 Angular 6 更好(万岁!),所以我误认为它是 Angular 或 Jest 错误。
我将我的项目从 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 兼容?
错误是我在转移到 Jest 时忘记了 remove/replace 旧的 karma-builder 配置。
显然 Angular 7 检查类似的东西比 Angular 6 更好(万岁!),所以我误认为它是 Angular 或 Jest 错误。