npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

karma-docker-launcher

v1.0.0

Published

A Karma plugin. Launcher for headless browsers in Docker containers.

Readme

karma-docker-launcher

GitHub Actions build status

A Karma plugin. Launcher for headless browsers in Docker containers.

Why?

When running tests in e.g. ChromeHeadless, you need a locally installed Chrome binary and the environment variable CHROME_BIN pointing to its location. It is more convenient to run your headless browsers in a Docker container, especially during automated builds. This package allows you to do just that.

This package uses the Docker Engine API, so it can even run without Docker binary, which is useful when Karma itself is running inside a node container. It is easily configurable for testing in Chrome, Firefox or any other browser that runs inside a Docker container.

Run your Karma tests on a headless browser in a Docker container.

Installation

The easiest way is to keep karma-docker-launcher as a devDependency in your package.json.

You can simple do it by:

npm install karma-docker-launcher --save-dev

Configuration

// karma.conf.js
module.exports = function (config) {
  config.set({
    browsers: ['ChromeHeadlessDocker', 'FirefoxHeadlessDocker'],
    customLaunchers: {
      ChromeHeadlessDocker: {
        base: 'Docker',   
        modemOptions: {
          socketPath: '/var/run/docker.sock'
        },
        createOptions: {
          Image: 'alpeware/chrome-headless-trunk',
          Env: ['CHROME_OPTS=$KARMA_URL'],
          HostConfig: {
            NetworkMode: 'host'
          }
        }
      },
      FirefoxHeadlessDocker: {
        base: 'Docker',
        modemOptions: {
          socketPath: '/var/run/docker.sock'
        },
        createOptions: {
          Image: 'rkuzsma/firefox-headless-stable:latest',
          Cmd: ['firefox', '-p', 'headless', '-headless', '-no-remote', '-url', '$KARMA_URL'],
          HostConfig: {
            NetworkMode: 'host'
          }
        }
      }
    }                 
   });
};
  • Each image you want to run has to be configured in customLaunchers, where base is Docker.

  • modemOptions is specified by the docker-modem package. Please refer to its REAMDE.md to see the available options. Most applications only need socketPath: '/var/run/docker.sock'.

  • createOptions is specified by de Docker Engine API. Only Image is required. Refer to the official Docker docs to see all available options. Please mind the capitalisation of the keys.

  • All occurrences of $KARMA_URL will be replaced by the actual url provided by Karma; typically http://localhost:9876/?id=1234.

Running Karma

Running Karma can be done in two ways:

  1. Directly, e.g. using npm run test.

  2. In a Docker container, e.g. using docker run (...) node npm run test.

Examples

See the example application in the examples folder. Most notably are the configuration file karma.conf.js and the scripts in the scripts folder.

Alternatives

This package differs from karma-chrome-launcher and karma-firefox-launcher in one important way. The Chrome and Firefox launchers need the binaries to be installed locally, whereas this package only needs a Docker daemon to talk to.

This package is inspired by @rkuzsma/karma-docker-launcher but works essentially differently. Because this package manages the containers via the Docker Engine rather than the Docker CLI, it is possible to run Karma itself in a Docker.


For more information on Karma see the homepage.