DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk3 min

How to Add Chrome Binary for Karma Tests on Headless Chrome CI

Make Karma find Chrome in headless CI by setting CHROME_BIN to an executable in the runner and launching ChromeHeadless.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set CHROME_BIN to the Chrome executable available in your CI runner, and configure Karma to launch ChromeHeadless. Install karma-chrome-launcher as a development dependency. If your project uses Puppeteer, its executablePath() can provide the binary path.

Configure Karma to launch headless Chrome

  1. Install the launcher: npm i -D karma-chrome-launcher.
  2. Make sure Chrome or Chromium is installed in the runner environment, or supplied by a browser automation dependency.
  3. Set the appropriate binary environment variable where the Karma process can see it: CHROME_BIN for Chrome, or CHROMIUM_BIN for Chromium.
  4. Set Karma’s browser to ChromeHeadless in karma.conf.js.
  5. Run Karma in single-run mode in CI so the test process exits after completing.

For example, the command pattern documented in Chrome’s Karma guide is karma start --single-run --browsers ChromeHeadless. Adapt it to your project’s scripts and CI provider. Chrome for Developers’ Karma guide also contains older Travis-specific instructions; treat those as legacy provider guidance, not a universal current setup.

As an Amazon Associate I earn from qualifying purchases.

Set CHROME_BIN from Puppeteer

If Puppeteer is already part of the project setup, set the variable before Karma starts so the launcher can use Puppeteer’s installed browser executable:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
process.env.CHROME_BIN = require('puppeteer').executablePath()

module.exports = function (config) {
  config.set({
    browsers: ['ChromeHeadless']
  })
}

This only works when Puppeteer’s browser executable is available inside the same CI environment in which Karma runs. Do not assume a universal path: it depends on the operating system, runner image, and how the browser was installed.

#1 Best Overall
Lenovo 2024 Convertible 2-in-1 Lightweight Chromebook, 11” HD IPS Touchscreen, Intel Processor Up to 2.60GHz, 4GB Ram, 32GB SSD, Super-Fast WiFi, Chrome OS, Dale Black (Renewed)
  • Intel Processor Up to 2.60GHz, 4GB Ram, 32GB SSD
  • 11” HD IPS Touchscreen with 360 Flip, Intel Graphics
  • 2x USB Type-C, 2x USB Type-A, 1x Headphone/Microphone Jack
  • Super-Fast Wifi and Bluetooth Combo, Integrated Webcam
  • Chrome OS, AC Charger Included, Dale Black Color

Choose how the browser gets into CI

Approach Setup Considerations
CI-installed Chrome or Chromium Install the browser in the runner environment and set CHROME_BIN or CHROMIUM_BIN to its executable path. Check whether the runner image provides the browser, whether the path is stable, and who maintains the installation.
Puppeteer-provided browser Use require('puppeteer').executablePath() as CHROME_BIN. Account for Puppeteer dependency and browser-version management, and confirm the downloaded browser works on the CI platform.

Neither approach is universally preferable; choose according to how your project manages browser installation.

Add runner-specific Chrome flags only when needed

If your runner requires additional Chrome flags, define a custom launcher based on ChromeHeadless and supply the necessary flags. The karma-chrome-launcher README documents custom launchers. Select flags for the constraints of your actual runner rather than copying a flag as a blanket fix. An older Chrome guide discusses --no-sandbox in a Travis example; verify your current runner’s requirements before using it.

Rank #2
Sale
Samsung Chromebook 3 Intel N3060 4GB 16GB 11.6-inch LED Google Chrome OS Laptop (Renewed)
  • 11.6" 1366 x 768 Anti-Glare Display, Intel Celeron N3060 Dual-Core 1.6 GHz (with Max Turbo Speed of 2.16GHz)
  • 16GB eMMC storage, 4GB LPDDR3 SDRAM system memory
  • 802.11ac Wireless LAN and bluetooth, 1 x USB 3.0 port, 1 x USB 2.0 port, 1 x DisplayPort, 1 x HDMI port, 1 x headphone jack, 1 x microphone jack
  • HD Display, 720p webcam, 11 hours of battery life
  • Graphics: Intel HD graphics, Chrome OS, 2-cell li-ion battery, Weight: 2.54 lbs

Troubleshoot common launch failures

  • Karma cannot find Chrome: Check that CHROME_BIN is set in the environment of the process that starts Karma and points to an executable present in that runner.
  • Using Chromium instead of Chrome: Use the matching launcher and variable: ChromiumHeadless with CHROMIUM_BIN, rather than assuming CHROME_BIN applies to every Chromium variant.
  • The browser path works locally but not in CI: Local paths do not establish the path inside the runner. Install or provide the browser there, then set the variable in that environment.
  • Karma starts in interactive mode or does not exit: Run the CI job in single-run mode, for example with --single-run.
  • Chrome exits immediately in a constrained runner: Identify the runner-specific requirement before adding flags. Configure only the needed options in a custom launcher and verify them against the runner’s current behavior.

Or skip the browser setup

If your goal is to capture a website rather than run Karma tests, ScreenshotNeo provides a screenshot API and MCP server. A single GET request can return an image or PDF. Its cleanup can accept consent banners and remove known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, with verdict and billing information in response headers. Its MCP server offers screenshot, page-info, and PDF-capture tools for AI agents.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Example request (see the ScreenshotNeo API documentation):

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo.

Rank #3
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Frequently Asked Questions

Which environment variable does ChromeHeadless use?

The Chrome launcher uses CHROME_BIN. Chromium variants use CHROMIUM_BIN.

Can I use Puppeteer’s browser with Karma?

Yes. Set process.env.CHROME_BIN to require('puppeteer').executablePath() before configuring or launching Karma, and ensure that executable is available in CI.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

Bestseller No. 1
SaleBestseller No. 2
Samsung Chromebook 3 Intel N3060 4GB 16GB 11.6-inch LED Google Chrome OS Laptop (Renewed)
Samsung Chromebook 3 Intel N3060 4GB 16GB 11.6-inch LED Google Chrome OS Laptop (Renewed)
16GB eMMC storage, 4GB LPDDR3 SDRAM system memory; HD Display, 720p webcam, 11 hours of battery life
$75.00
Bestseller No. 3
HP Chromebook 11 G6 Ee 11.6' Chromebook Intel Celeron 1.10 GHz 4 GB 16 GB Chrome OS (Renewed)
HP Chromebook 11 G6 Ee 11.6" Chromebook Intel Celeron 1.10 GHz 4 GB 16 GB Chrome OS (Renewed)
Storage: 16 GB Flash Memory; OS: Chrome OS; Screen Size: 11.6"
$64.99
Bestseller No. 4
Dell 11' HD IPS Convertible Chromebook with Touchscreen, Intel Quad-Core Processor Up to 2.2GHz, 4GB Ram, 32GB Storage, Ultra-Fast WiFi, Chrome OS, Dark Black (Renewed)
Dell 11" HD IPS Convertible Chromebook with Touchscreen, Intel Quad-Core Processor Up to 2.2GHz, 4GB Ram, 32GB Storage, Ultra-Fast WiFi, Chrome OS, Dark Black (Renewed)
Intel Quad Core Processor Up to 2.2GHz, 4GB Memory, 32GB storage; 11" HD IPS Touchscreen Display (1366 x 768), Intel Graphics
$119.99
Rank #4
Dell 11" HD IPS Convertible Chromebook with Touchscreen, Intel Quad-Core Processor Up to 2.2GHz, 4GB Ram, 32GB Storage, Ultra-Fast WiFi, Chrome OS, Dark Black (Renewed)
  • Intel Quad Core Processor Up to 2.2GHz, 4GB Memory, 32GB storage
  • 11" HD IPS Touchscreen Display (1366 x 768), Intel Graphics
  • Ultra-Fast WiFi and Bluetooth, Integrated Webcam
  • 2x USB Type A, 2x USB Type C, 1x Headphone/Microphone Combo Jack
  • Chrome OS, Dell AC Charger Included, Dark Black Color

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.