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.

tests hang with --single-run but are fine with just ng test

See original GitHub issue

Bug Report or Feature Request (mark with an x)

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

Versions.

@angular/cli: 1.2.7
node: 6.10.3
os: win32 x64
@angular/animations: 4.3.3
@angular/cdk: 2.0.0-beta.8
@angular/common: 4.3.3
@angular/compiler: 4.3.3
@angular/core: 4.3.3
@angular/flex-layout: 2.0.0-beta.8
@angular/forms: 4.3.3
@angular/http: 4.3.3
@angular/material: 2.0.0-beta.8
@angular/platform-browser: 4.3.3
@angular/platform-browser-dynamic: 4.3.3
@angular/router: 4.3.3
@angular/cli: 1.2.7
@angular/compiler-cli: 4.3.3

Chrome: 60.0.3112.90

Repro steps.

I am struggling to isolate this issue, if I create a clean cli project, it runs fine. However, I have tried copying over the karma.conf and angular-cli files and that makes no difference, aside from that, I can’t see what the difference would be?

The log given by the failure.

Very reliably the ng test command will work, but adding the --single-run flag causes chrome to have an issue opening. These tests ran fine before I upgraded my project dependencies - I was previously on 4.1.

C:\Users\George\Source\Repos\myProj>ng test --single-run
 10% building modules 2/2 modules 0 active04 08 2017 23:22:58.078:INFO [karma]: Karma v1.7.0 server started at http://0.0.0.0:9876/
04 08 2017 23:22:58.085:INFO [launcher]: Launching browser Chrome with unlimited concurrency
04 08 2017 23:22:58.095:INFO [launcher]: Starting browser Chrome
 94% asset optimization04 08 2017 23:24:11.543:WARN [launcher]: Chrome have not captured in 60000 ms, killing.
04 08 2017 23:24:13.663:INFO [launcher]: Trying to start Chrome again (1/2).
04 08 2017 23:24:17.923:INFO [Chrome 60.0.3112 (Windows 10 0.0.0)]: Connected on socket tNw7OJK58Y3Dz3nBAAAA with id 84048778
04 08 2017 23:24:27.934:WARN [Chrome 60.0.3112 (Windows 10 0.0.0)]: Disconnected (1 times), because no message in 10000 ms.
Chrome 60.0.3112 (Windows 10 0.0.0) ERROR
  Disconnected, because no message in 10000 ms.
Chrome 60.0.3112 (Windows 10 0.0.0) ERROR
  Disconnected, because no message in 10000 ms.

Chrome 60.0.3112 (Windows 10 0.0.0) ERROR
  Disconnected, because no message in 10000 ms.


C:\Users\George\Source\Repos\myProj>ng test
 10% building modules 2/2 modules 0 active04 08 2017 23:25:18.994:WARN [karma]: No captured browser, open http://localhost:9876/
04 08 2017 23:25:19.021:INFO [karma]: Karma v1.7.0 server started at http://0.0.0.0:9876/
04 08 2017 23:25:19.023:INFO [launcher]: Launching browser Chrome with unlimited concurrency
04 08 2017 23:25:19.058:INFO [launcher]: Starting browser Chrome
 94% asset optimization04 08 2017 23:26:33.160:WARN [launcher]: Chrome have not captured in 60000 ms, killing.
04 08 2017 23:26:34.280:WARN [karma]: No captured browser, open http://localhost:9876/
04 08 2017 23:26:34.481:INFO [launcher]: Trying to start Chrome again (1/2).
04 08 2017 23:26:40.057:INFO [Chrome 60.0.3112 (Windows 10 0.0.0)]: Connected on socket 1ZJHTIhi1AMeRaMZAAAA with id 38870052
Chrome 60.0.3112 (Windows 10 0.0.0): Executed 86 of 86 SUCCESS (0 secs / 0 secs)

Desired functionality.

The sing-run flag to have no impact on the tests running

Mention any other details that might be useful.

I am quite puzzled by this, I will keep debugging, but thought I’d open this to see if anyone else had come across it, and even if it is something in my project, the flag shouldn’t (in my view) make any difference to it.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
ChenReuvencommented, Aug 21, 2017

i have also the same issue. angular cli 1.3.1 + chrome headless and simallar configuration as above…

  • the workaround work but it seem awkward…
4reactions
HerrEmilcommented, Aug 9, 2017

@georgeedwards I had the same issue today when upgrading dependencies on a large angular-cli project. A workaround that works for me is to set the karma configuration option browserNoActivityTimeout to a larger value than the default. Also, setting the captureTimeout option to a larger value will prevent the browser from restarting while your project is building.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 7 : ng test hangs , keeps running tests repeatedly
json workspace file and not just the main application. Then it looks like it goes on indefinitely or there is a bug and...
Read more >
Testing - Angular
Testing your Angular application helps you check that your application is working as you expect. ... Just run the ng test CLI command:...
Read more >
Troubleshooting - Karma test runner
karma has an extensive set of tests and we have limited time to help with bugs. Here are some suggestions to get you...
Read more >
[How-to] Running Angular tests on continuous integration ...
You run ng test on your machine and everything works great. ... Note that I also changed singleRun to true so that the...
Read more >
Angular 7: Testing
In this chapter we're going to be covering how to unit test your Angular apps. Testing Tools. In order to test our apps,...
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