Socket
Socket
Sign inDemoInstall

karma-phantomjs-launcher

Package Overview
Dependencies
205
Maintainers
4
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    karma-phantomjs-launcher

A Karma plugin. Launcher for PhantomJS.


Version published
Weekly downloads
116K
increased by1.21%
Maintainers
4
Created
Weekly downloads
 

Changelog

Source

1.0.4 (2017-03-10)

Bug Fixes
  • windows pathing (895fb860, closes #167)

<a name"1.0.3"></a>

Readme

Source

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.

Keywords

FAQs

Last updated on 10 Mar 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc