bbc/karma-phantomjs-launcher

Name: karma-phantomjs-launcher

Owner: BBC

Description: A Karma plugin. Launcher for PhantomJS.

Forked from: karma-runner/karma-phantomjs-launcher

Created: 2017-11-08 16:57:06.0

Updated: 2017-11-08 16:57:08.0

Pushed: 2017-11-08 17:03:43.0

Homepage:

Size: 92

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

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

m install --save-dev karma-phantomjs-launcher
Configuration
arma.conf.js
le.exports = function(config) {
nfig.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

ons: {
ndowName: 'my-window',
ttings: {
webSecurityEnabled: false


is equivalent to:

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

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

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

rma 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.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.