Solvedangular cli ng test not obeying single run flag

Versions

Angular CLI: 6.0.0
Node: 10.0.0
OS: win32 x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.0
@angular-devkit/build-angular     0.6.0
@angular-devkit/build-optimizer   0.6.0
@angular-devkit/core              0.6.0
@angular-devkit/schematics        0.6.0
@angular/cdk                      6.0.1
@angular/material                 6.0.1
@ngtools/webpack                  6.0.0
@schematics/angular               0.6.0
@schematics/update                0.6.0
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.6.0

Repro steps

  • Upgrade Angular CLI to V6 (global/local)
  • Upgrade Angular to V6
  • Upgrade other dependencies
  • Ensure karma.conf.js has singleRun: false in it
  • Run ng t OR run ng t --single-run=false

Observed behavior

If ng t is run, tests will run successfully but browser window will close on finish (despite karma.conf.js having singleRun: false inside it)

If ng t --single-run=false is run, it errors: Unknown option: '--singleRun' Note that running ng t --no-single-run creates the same error.

Desired behavior

I would like the browser window to remain open, as it always did, pre-upgrade

23 Answers

✔️Accepted Answer

I switch ng test --single-run to ng test --watch=false and it is works good.

Other Answers:

This works:

ng test --watch

Cheers!

--no-watch should also work (more elegant).

The wiki of the angular-cli says:
You can run tests a single time via --watch=false
https://github.com/angular/angular-cli/wiki/test
tried it out and it works

is ng test --single-run is equivalent to ng test now in angular6?
I observed same behavior.

More Issues: