简体   繁体   English

使用--watch = false的Angular CLI 6覆盖返回错误

[英]Angular CLI 6 coverage with --watch=false returns error

When I run 我跑的时候

ng test --watch=false --code-coverage --no-progress

I get 我明白了

Schema validation failed with the following errors:
  Data path ".watch" should be boolean.

I searched but can't find a hit for this error. 我搜索但无法找到此错误的命中。

The docs ( https://github.com/angular/angular-cli/wiki/test ) clearly say --watch=false should work. 文档( https://github.com/angular/angular-cli/wiki/test )清楚地说--watch = false应该有效。

Other people say it works, for example https://github.com/angular/angular-cli/issues/10711#issuecomment-387704999 其他人说它有效,例如https://github.com/angular/angular-cli/issues/10711#issuecomment-387704999

I'm on angular/cli 6.2.4. 我在角度/ cli 6.2.4。 angular 6.1.9 角度6.1.9

Has anyone encountered this? 有没有遇到过这个?

Do you have more than one project in your angular workspace (angular.json)? 您的角度工作区(angular.json)中有多个项目吗? I have received this error when running ng test --watch=false on a workspace with multiple projects. 在具有多个项目的工作区上运行ng test --watch=false时,我收到此错误。

You can run the test command on the project by name eg 您可以按名称对项目运行测试命令,例如

ng run PROJECT_NAME:test --watch=false --code-coverage --no-progress

you need to substitute in the name of your project for PROJECT_NAME 您需要在项目名称中替换PROJECT_NAME

尝试singleRun: true,在karma.conf.js配置中,如果您希望测试继续观察更改并自动运行测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM