I like to run my karma unit tests on a headless chrome. Using karma-chrome-launcher and setting the browser to "ChromeHeadless" works on my machine. But on the CI server it fails with the message "No binary for ChromeHeadless browser on your platform." Installing chrome on the CI machine is not possible. Is there another way to load the chrome binaries? for example the google puppeteer module seems to load that when run. from the docs: "Puppeteer downloads and uses a specific version of Chromium". How can i achieve the same?
Asked
Active
Viewed 2.2k times
2 Answers
19
You can use Puppeteer (headless Chromium), follow these instructions.

Oleksandr Fediashov
- 4,315
- 1
- 24
- 42
-
2thanx for the answer and the link. unfortunately our ci cleans everything then install everything again, which means Puppeteer downloading the chromium each time would be too slow for our setup. But technically this would work. – mbehzad Sep 07 '17 at 14:54
-
Puppeteer has [pre-built docker images](https://pptr.dev/guides/docker) that you can use in your CI. Most CI systems should have a way to cache docker `pull` requests. – stefan2718 Aug 28 '23 at 17:26
2
If what you fear is that download from the internet might be slow, you can tell puppeteer where to download chrome from and use a local address.
Use PUPPETEER_DOWNLOAD_HOST
to specify where to download Chrome from and PUPPETEER_SKIP_CHROMIUM_DOWNLOAD
to skip downloading Chrome altogether.
You can read more about this in the documentation.

hamzahik
- 714
- 4
- 7