karma-phantomjs-launcher

A Karma plugin. Launcher for PhantomJS.

PhantomJS development have stopped, use puppeteer or similar
Last updated 11 years ago by vojtajina .
MIT · Repository · Original npm · Tarball · package.json
$ npm install karma-phantomjs-launcher 
SYNC missed versions from official npm registry.

karma-phantomjs-launcher

js-standard-style npm version npm downloads

Build Status Dependency Status devDependency Status

Launcher for PhantomJS.

Installation

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

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

Configuration

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

    // you can define custom flags
    customLaunchers: {
      'PhantomJS_custom': {
        base: 'PhantomJS',
        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 PhantomJS_custom

If you set the debug option to true, you will be instructed to launch a web browser to bring up the debugger. Note that you will want to put debugger; statements in your JavaScript to hit breakpoints. You should be able to put breakpoints in both your test code and your client code. Note that the debug option automatically adds the --remote-debugger-port=9000 and --remote-debugger-autorun=yes switches to PhantomJS.


For more information on Karma see the homepage.

Current Tags

  • 1.0.4                                ...           latest (8 years ago)

17 Versions

  • 1.0.4 [deprecated]           ...           8 years ago
  • 1.0.3 [deprecated]           ...           8 years ago
  • 1.0.2 [deprecated]           ...           8 years ago
  • 1.0.1 [deprecated]           ...           8 years ago
  • 1.0.0 [deprecated]           ...           9 years ago
  • 0.2.3 [deprecated]           ...           9 years ago
  • 0.2.2 [deprecated]           ...           9 years ago
  • 0.2.1 [deprecated]           ...           9 years ago
  • 0.2.0 [deprecated]           ...           9 years ago
  • 0.1.4 [deprecated]           ...           11 years ago
  • 0.1.3 [deprecated]           ...           11 years ago
  • 0.1.2 [deprecated]           ...           11 years ago
  • 0.1.1 [deprecated]           ...           11 years ago
  • 0.1.0 [deprecated]           ...           11 years ago
  • 0.0.3 [deprecated]           ...           11 years ago
  • 0.0.2 [deprecated]           ...           11 years ago
  • 0.0.1 [deprecated]           ...           12 years ago
Maintainers (1)
Downloads
Total 2
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (4)

© 2010 - cnpmjs.org x YWFE | Home | YWFE