• Stars
    star
    467
  • Rank 93,935 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 11 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Karma plugin. Launcher for Chrome and Chrome Canary.

karma-chrome-launcher

js-standard-style npm version npm downloads

Build Status Dependency Status devDependency Status

Launcher for Google Chrome, Google Chrome Canary and Google Chromium.

Installation

The easiest way is to keep karma-chrome-launcher as a devDependency in your package.json, by running

$ npm i -D karma-chrome-launcher

Configuration

// karma.conf.js
module.exports = function(config) {
  config.set({
    browsers: ['Chrome', 'Chrome_without_security'], // You may use 'ChromeCanary', 'Chromium' or any other supported browser

    // you can define custom flags
    customLaunchers: {
      Chrome_without_security: {
        base: 'Chrome',
        flags: ['--disable-web-security', '--disable-site-isolation-trials']
      }
    }
  })
}

The --user-data-dir is set to a temporary directory but can be overridden on a custom launcher as shown below. One reason to do this is to have a permanent Chrome user data directory inside the project directory to be able to install plugins there (e.g. JetBrains IDE Support plugin).

customLaunchers: {
  Chrome_with_debugging: {
    base: 'Chrome',
    chromeDataDir: path.resolve(__dirname, '.chrome')
  }
}

You can pass list of browsers as a CLI argument too:

$ karma start --browsers Chrome,Chrome_without_security

Headless Chromium with Puppeteer

The Chrome DevTools team created Puppeteer - it will automatically install Chromium for all platforms and contains everything you need to run it from within your CI.

Available Browsers

Note: Headless mode requires a browser version >= 59

  • Chrome (CHROME_BIN)
  • ChromeHeadless (CHROME_BIN)
  • Chromium (CHROMIUM_BIN)
  • ChromiumHeadless (CHROMIUM_BIN)
  • ChromeCanary (CHROME_CANARY_BIN)
  • ChromeCanaryHeadless (CHROME_CANARY_BIN)
  • Dartium (DARTIUM_BIN)

Usage

$ npm i -D puppeteer karma-chrome-launcher
// karma.conf.js
process.env.CHROME_BIN = require('puppeteer').executablePath()

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

For more information on Karma see the homepage.

More Repositories

1

karma

Spectacular Test Runner for JavaScript
JavaScript
11,952
star
2

karma-coverage

A Karma plugin. Generate code coverage.
JavaScript
768
star
3

karma-jasmine

A Karma plugin - adapter for Jasmine testing framework.
JavaScript
542
star
4

grunt-karma

Grunt plugin for Karma.
JavaScript
468
star
5

karma-mocha

A Karma plugin. Adapter for Mocha testing framework.
JavaScript
379
star
6

gulp-karma

Example of using Karma with Gulp.
JavaScript
310
star
7

karma-phantomjs-launcher

A Karma plugin. Launcher for PhantomJS.
JavaScript
281
star
8

karma-ng-html2js-preprocessor

A Karma plugin. Compile AngularJS 1.x and 2.x templates to JavaScript on the fly.
CoffeeScript
266
star
9

karma-sauce-launcher

A Karma plugin. Launch any browser on SauceLabs!
TypeScript
199
star
10

karma-junit-reporter

A Karma plugin. Report results in junit xml format.
JavaScript
176
star
11

karma-browserstack-launcher

A Karma plugin. Launch any browser on BrowserStack!
JavaScript
150
star
12

karma-firefox-launcher

A Karma plugin. Launcher for Firefox.
JavaScript
104
star
13

karma-html2js-preprocessor

A Karma plugin. Convert HTML files into JS strings to serve them in a script tag.
CoffeeScript
74
star
14

karma-commonjs

A Karma plugin. Test CommonJS modules.
JavaScript
73
star
15

karma-webdriver-launcher

A plugin for Karma. Launch any browser with WebDriver.
JavaScript
66
star
16

karma-ie-launcher

A Karma plugin. Launcher for Internet Explorer.
JavaScript
59
star
17

karma-coffee-preprocessor

A Karma plugin. Compile coffee script on the fly.
JavaScript
53
star
18

karma-cli

The Karma command line interface.
JavaScript
52
star
19

karma-qunit

A Karma plugin. Adapter for QUnit testing framework.
JavaScript
51
star
20

maven-karma-plugin

Maven plugin for running tests using Karma.
Java
45
star
21

karma-requirejs

A Karma plugin. Adapter for RequireJS framework.
JavaScript
39
star
22

karma-teamcity-reporter

A Karma plugin. Report results for Teamcity CI.
JavaScript
34
star
23

karma-intellij

Reporter for IntelliJ / WebStorm.
JavaScript
34
star
24

karma-growl-reporter

A Karma plugin. Report results with growl.
JavaScript
27
star
25

karma-ng-scenario

A Karma plugin. Adapter for Angular's Scenario Runner.
JavaScript
25
star
26

karma-runner.github.com

Homepage of Karma - The Spectacular JavaScript Test Runner.
HTML
24
star
27

karma-edge-launcher

A Karma plugin. Launcher for Microsoft Edge.
JavaScript
21
star
28

karma-safari-launcher

A Karma plugin. Launcher for Safari.
JavaScript
19
star
29

karma-closure

A Karma plugin. Resolve Google Closure dependencies on the fly.
JavaScript
18
star
30

karma-dart

DEPRECATED. A plugin for Dart language.
JavaScript
16
star
31

karma-slimerjs-launcher

A Karma launcher for SlimerJS
JavaScript
13
star
32

karma-traceur-preprocessor

A Karma plugin. Compile ES6 script on the fly using traceur-compiler.
JavaScript
13
star
33

karma-nodeunit

A Karma plugin - adapter for Node unit testing framework.
JavaScript
12
star
34

karma-script-launcher

A Karma plugin. Launcher for custom scripts.
JavaScript
9
star
35

integration-tests

JavaScript
8
star
36

karma-dojo

A Karma plugin. Adapter for Dojo Toolkit.
JavaScript
7
star
37

karma-opera-launcher

A Karma plugin. Launcher for Opera.
JavaScript
7
star
38

test-device-manager

Keep-alive test browsers and redirect them to a test server on command.
JavaScript
6
star
39

karma-ember-preprocessor

A Karma plugin. Preprocessor for Ember.js templates (handlebars).
JavaScript
6
star
40

karma-googmodule-preprocessor

A Karma preprocessor to handle Closure's goog.module() system
JavaScript
5
star
41

shared-karma-files

Shared configs for all the Karma repos.
CoffeeScript
2
star