Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

karma-phantomjs2-launcher

gskachkov2.2kMITdeprecated0.5.0

Use karma-phantomjs-launcher@1.0.0 instead

A Karma plugin. Launcher for PhantomJS 2. Slightly changed karma-phantomjs-launcher plugin.ß

karma-plugin, karma-launcher, phantomjs, phantomjs2

readme

karma-phantomjs2-launcher

Launcher for [PhantomJS 2]. As for now it is temporary solution, until default karma-phantomjs-launcher is not support of the PhantomJS 2. PhantomJS 2 is not stable PhantomJS-2 Loading PhantomJS from custom ULR can be done by setting the PHANTOMJS2_DOWNLOAD_URL environment variable.

Installation

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

$ npm install --save-dev karma-phantomjs2-launcher

Configuration

// karma.conf.js
module.exports = function(config) {
  config.set({
    browsers: ['PhantomJS2', 'PhantomJS2_custom'],

    // you can define custom flags
    customLaunchers: {
      'PhantomJS2_custom': {
        base: 'PhantomJS2',
        options: {
          windowName: 'my-window',
          settings: {
            webSecurityEnabled: false
          },
        },
        flags: ['--load-images=true'],
        debug: true
      }
    },

    phantomjsLauncher: {
      // Have phantomjs exit if a ResourceError is encountered (useful if karma exits without killing phantom)
      exitOnResourceError: true
    }
  })
}

The options attribute allows you to initialize properties on the phantomjs page object, so

options: {
  windowName: 'my-window',
  settings: {
    webSecurityEnabled: false
  },
}

is equivalent to:

var webPage = require('webpage')
var page = webPage.create()

page.windowName = 'my-window'
page.settings.webSecurityEnabled = false

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

$ karma start --browsers PhantomJS2_custom

For more information on Karma see the homepage.

changelog

<a name"0.2.2">

0.2.2 (2015-12-24)

Bug Fixes

  • pass PhantomJS script as the first cmd-line argument (1c195c6b)
  • do not duplicate cmd-line flags on repeated PhantomJS runs (76228f18)

<a name"0.2.1">

0.2.1 (2015-08-05)

Bug Fixes

  • ensure console output from phantomjs is available in karma debug logs (eed281b5)

<a name"0.2.0">

0.2.0 (2015-05-29)

Bug Fixes

  • npm: Make .npmignore more sensible to dot files (1322a89d, closes #68)

Features

  • Move phantomjs to peerDeps, #37, #42, #56 (a0f399de, closes #25)
  • Support option for phantom to exit on ResourceError (2b90c6b9)
  • debug option (c6dfe786)