我想知道是否有办法为 ng test
文件中的 angular.json
设置默认配置。
我有这棵树:
...
"projects": {
"myProject": {
...
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
...
},
"configurations": {
"production": {
...
},
"development": {
...
}
}
},
"serve": {
...
"options": {
"browserTarget": "myProject:build:development"
},
},
"test": {
"options": {
"browserTarget": "myProject:build:development",
}
}
}
}
}
所以我通过设置 serve
将 build:development
默认设置为 options.browserTarget
,因此当我运行 ng serve
时,CLI 运行 development
配置。< /p>
现在,当我在没有任何 build:development
设置的情况下运行 ng test
时,如果明显没有 --configuration
设置,我应该怎么做才能运行 options.browserTarget
?此配置为 ng test
引发此错误:
Schema validation failed with the following errors:
Data path "" should NOT have additional properties(browserTarget).
为 ng build
设置默认配置的正确解决方案是什么?