Angular CLI 6 未知选项:'--singleRun'

Angular CLI 6 Unknown option: '--singleRun'

当我想执行我的测试时,我曾经激活了 --single-run 选项,但升级到 Angular 6 后,它不再被识别了。

> ng test --source-map=false --single-run --no-progress --browsers=ChromeNoSandbox

Unknown option: '--singleRun'

Angular CLI 6 中 --single-运行 的等效选项是什么?

你应该使用ng test

ng test --watch=false

使用旧版本的 angular-cli,您过去可以同时使用 --singleRun--watch=false 来完成同一件事。现在他们删除了 --singleRun

您仍然可以使用 ng test --watch=false

Angular cli 1.x docs

Tests will execute after a build is executed via Karma, and it will automatically watch your files for changes. You can run tests a single time via --watch=false or --single-run.

Angular cli 6.x docs

Tests will execute after a build is executed via Karma, and it will automatically watch your files for changes. You can run tests a single time via --watch=false.

请参考本期评论

https://github.com/angular/angular-cli/issues/10711#issuecomment-387704999

从Angularv6开始,不需要指定--single-运行