angular-cli: ng test with no --watch option hangs after test run

Bug Report or Feature Request (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [x ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

OS: macOs Mojave 10.14 (18A391)

Angular CLI: 7.0.3
Node: 11.0.0
OS: darwin x64
Angular: 7.0.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.10.3
@angular-devkit/build-angular     0.10.3
@angular-devkit/build-optimizer   0.10.3
@angular-devkit/build-webpack     0.10.3
@angular-devkit/core              7.0.3
@angular-devkit/schematics        7.0.3
@angular/cdk                      7.0.2
@angular/cli                      7.0.3
@angular/flex-layout              7.0.0-beta.19
@angular/material                 7.0.2
@ngtools/webpack                  7.0.3
@schematics/angular               7.0.3
@schematics/update                0.10.3
rxjs                              6.3.3
typescript                        3.1.3
webpack                           4.19.1

Repro steps

I have been able to reproduce this both with an existing project and a brand new project scaffolded with ng new and no changes made to the code. In mac os Terminal

  1. Run ng test (no --watch option)
  2. After test run the process does not exist
  3. change code
  4. Does not re-run tests
  5. hit ctrl+c to exit, the browser window used to run the tests exit but the ng test process hangs and you must force exit it in Terminal

The log given by the failure

As far as I can tell, no logs are produced.

Desired functionality

Since the documentation states that the default value for the --watch option is false, ng test (no --watch option provided) should exhibit the same behavior as ng test --watch=false which is to run the tests once and exit.

Mention any other details that might be useful

While the ng test process is hanging, Activity Monitor shows a high number of threads used by the process

screen shot 2018-10-30 at 10 39 16 pm

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 7
  • Comments: 20 (3 by maintainers)

Most upvoted comments

still hangs no matter what parameters are given

@angular/cli": "7.0.6

ng test --watch=false

I downgraded node to version 10.13.0. The test process no longer hangs where I have to force close it in Terminal, I am able to use ctrl+c to kill the process. However, running ng test with no watch option still runs the tests in watch mode, but the docs say the default for watch is false.

Experiencing the same issue with travis and other linux based systems. Even with the --watch=false flag.

You can watch one failing because of this here: https://travis-ci.org/jsaalfeld/OpenSlides/jobs/449709536

Locally this “fails” or stalls also with CLI Version 7.0.4.

I am seeing this same issue but even when just running ng serve

I recently updated macos to mojave and CLI to the latest … So i think it is one of the two but dont know which one.