0
votes

I am working on an Angular 7 (7.2.13) app and am having trouble running npm run test, which maps to ng test --watch=false --browsers=ChromeHeadless.

I am running Ubuntu under Windows 10 and all of my app-relating command line stuff is done on Ubuntu. This is a requirement of the project, but I've only been here a few weeks and haven't yet found out why!

I have installed ChromeHeadless by following these instructions. I set CHROME_BIN=/usr/bin/chromium-browser after doing this. However, it looks like ChromeHeadless is having trouble starting:

27 05 2019 11:26:40.497:INFO [karma-server]: Karma v4.0.1 server started at http://0.0.0.0:9876/

27 05 2019 11:26:40.500:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited #

27 05 2019 11:26:40.506:INFO [launcher]: Starting browser ChromeHeadless 27 05 2019 11:27:40.507:WARN [launcher]: ChromeHeadless have not captured in 60000 ms, killing.

27 05 2019 11:27:40.724:INFO [launcher]: Trying to start ChromeHeadless again (1/2).

It tries again a few times, but just times out. I have seen a few posts about turning on verbose logging, but modifying the captureTimeout has only the effect of making the process slower!

Can anyone help?

1
Do you have karma-chrome-launcher installed?Ander2

1 Answers

1
votes

I solved an issue with this same message caused by a proxy-blocker of the client. I had to set --proxy-server flag in my customLauncher in karma.conf.js, so the karma server could get the ChromeHeadless and execute the tests perfectly.

karma.conf.js

browsers: ['MyChromeHeadless'], 
    customLaunchers: {
    MyChromeHeadless: {
        base: 'ChromeHeadless',
        flags: [
          '--no-sandbox',
          '--proxy-bypass-list=*',
          '--proxy-server=http://proxy.your.company'
        ]
      }
    }