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
Size: 92
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Launcher for PhantomJS.
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
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.