[英]Angular.json - set default configuration for test
I'd like to know if there is a way to set default configuration for ng test
in angular.json
file.我想知道是否有办法在
angular.json
文件中为ng test
设置默认配置。
I have this tree:我有这棵树:
...
"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",
}
}
}
}
}
So I have the serve
default set to build:development
by setting options.browserTarget
and thus when I run ng serve
, the CLI runs the development
configuration.因此,我通过设置
options.browserTarget
将serve
默认设置为build:development
,因此当我运行ng serve
时,CLI 会运行development
配置。
Now, what should I do to run build:development
when I run ng test
without any --configuration
setting, when there is obviously no options.browserTarget
setting?现在,当我在没有任何
--configuration
设置的情况下运行ng test
时,如果显然没有options.browserTarget
设置,我应该怎么做才能运行build:development
? This configuration throws this error for ng test
:此配置为
ng test
引发此错误:
Schema validation failed with the following errors:
Data path "" should NOT have additional properties(browserTarget).
And what is the proper solution to set default configuration for ng build
?为
ng build
设置默认配置的正确解决方案是什么?
Under your test section you can add the following tag defaultConfiguration this should specify the default to be used.在您的测试部分下,您可以添加以下标签defaultConfiguration这应该指定要使用的默认值。 This can also be added to the serve tag
这也可以添加到服务标签
"test": {
"builder": ..,
"options": {
...
},
"defaultConfiguration": "development"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.