question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'ng test' does not 'exit' after running unit test, something keeps running

See original GitHub issue

When I run ng test my unit tests are run successfully. With logLevel: config.LOG_DEBUG it reports the following:

01 06 2016 16:50:15.040:DEBUG [karma]: Run complete, exiting.
01 06 2016 16:50:15.040:DEBUG [launcher]: Disconnecting all browsers
01 06 2016 16:50:15.521:DEBUG [launcher]: Process Chrome exited with code 0
01 06 2016 16:50:15.521:DEBUG [temp-dir]: Cleaning temp dir /var/folders/bd/5l9p70517qgg73659f70pzgw0000gn/T/karma-14746095
01 06 2016 16:50:15.574:DEBUG [launcher]: Finished all browsers

But it doesn’t release the terminal. I don’t get back the prompt. So it seems something keeps running. I have this locally with the configuration below. As well as on a docker image (pimterry/node-karma).

This prevents me from running the unit tests on my CI environment because the process waits for the prompt to return.

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) OSX El Capitan 10.11.5
  1. Versions. Please run ng --version. If there’s nothing outputted, please run in a Terminal: node --version And paste the result here. angular-cli: 1.0.0-beta.5 node: 4.4.0 os: darwin x64
  2. Repro steps. Was this an app that wasn’t created using the CLI? What change did you do on your code? etc. It was created with the CLI
  3. The log given by the failure. Normally this include a stack trace and some more information. There is no log. It is just that my prompt doesn’t return.
  4. Mention any other details that might be useful. In the karma config: ‘autowatch=false’ and ‘singleRun=true’

I have also tried this with a fresh project generated with Angular CLI and nothing changed except the above settings in the Karma config. It has the same issue.


Thanks! We’ll be in touch soon.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

103reactions
filipesilvacommented, Jun 1, 2016

By default, unit tests will run in watch mode. You can override this by doing ng tests --watch=false instead.

19reactions
bentalycommented, Dec 7, 2017

The above should be ng test --watch=false

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 7 : ng test hangs , keeps running tests repeatedly
Try this command ng test -- --watch=false --code-coverage.
Read more >
ng test - Angular
Option Description Value Type Defau... ‑‑browsers Override which browsers tests are run against. string ‑‑code‑coverage Output a code coverage report. boolean false ‑‑code‑coverage‑exclude Globs to exclude...
Read more >
Run tests | IntelliJ IDEA Documentation - JetBrains
The test that has failed will be rerun in the debug mode. After that, the test will be suspended, allowing you to examine...
Read more >
How to Stop Jest Tests from Hanging in Angular | by Paul Kim
Jest test hangs, hanging, stuck, never finishes, not running, won't stop. An article to stop hanging Jest tests in an Angular project.
Read more >
Run jest for unit tests of modified files only | by SunCommander
Since we can always fetch changed files in a pull request on local and on CI, why not extract changed react files and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found