Socket
Socket
Sign inDemoInstall

grunt-lib-phantomjs

Package Overview
Dependencies
Maintainers
8
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-lib-phantomjs - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

15

lib/phantomjs.js

@@ -20,2 +20,3 @@ /*

var EventEmitter2 = require('eventemitter2').EventEmitter2;
var rimraf = require('rimraf');

@@ -51,4 +52,4 @@ // Get path to phantomjs binary

// Default options.
if (typeof options.killTimeout !== 'number') { options.timeout = 5000; }
options.options = options.options || {};
if (typeof options.killTimeout !== 'number') { options.killTimeout = 1000; }
options.options = options.options || {};

@@ -58,8 +59,10 @@ // All done? Clean up!

clearTimeout(id);
tempfile.unlink();
var kill = function(){
var kill = function() {
// Only kill process if it has a pid, otherwise an error would be thrown.
if (phantomJSHandle.pid){
if (phantomJSHandle.pid) {
phantomJSHandle.kill();
}
rimraf(tempfile.path, function(err) {
if (err) { throw err; }
});
if (typeof done === 'function') { done(null); }

@@ -174,3 +177,3 @@ };

// Ignore intentional cleanup.
if (code === 15 || code === null /* SIGTERM */){ return; }
if (code === 15 || code === null /* SIGTERM */) { return; }

@@ -177,0 +180,0 @@ // If we're here, something went horribly wrong.

15

package.json
{
"name": "grunt-lib-phantomjs",
"description": "Grunt and PhantomJS, sitting in a tree",
"version": "1.0.1",
"version": "1.0.2",
"author": {

@@ -20,11 +20,11 @@ "name": "Grunt Team",

"phantomjs-prebuilt": "^2.1.3",
"semver": "^4.3.0",
"rimraf": "^2.5.2",
"semver": "^5.1.0",
"temporary": "^0.0.8"
},
"devDependencies": {
"difflet": "^0.2.3",
"difflet": "^1.0.1",
"express": "^4.11.2",
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-jshint": "^0.11.0"
"grunt": "^1.0.1",
"grunt-contrib-jshint": "^1.0.0"
},

@@ -35,3 +35,4 @@ "main": "lib/phantomjs",

"phantomjs"
]
],
"appveyor_id": "69g3o5c5m0fyih9r"
}

@@ -9,3 +9,3 @@ /*

/*global phantom:true*/
/* jshint phantom:true */

@@ -84,3 +84,3 @@ 'use strict';

sendMessage(JSON.parse(str));
} catch(err) {
} catch (err) {
sendMessage('error.invalidJSON', str);

@@ -123,3 +123,3 @@ }

page.evaluate(function() {
/*jshint browser:true, devel:true */
/* jshint browser:true, devel:true */
document.addEventListener('DOMContentLoaded', function() {

@@ -126,0 +126,0 @@ alert('inject');

@@ -1,2 +0,2 @@

# grunt-lib-phantomjs [![Build Status](https://travis-ci.org/gruntjs/grunt-lib-phantomjs.png?branch=master)](https://travis-ci.org/gruntjs/grunt-lib-phantomjs)
# grunt-lib-phantomjs [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-lib-phantomjs.svg?branch=master)](https://travis-ci.org/gruntjs/grunt-lib-phantomjs) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/69g3o5c5m0fyih9r/branch/master?svg=true)](https://ci.appveyor.com/project/gruntjs/grunt-lib-phantomjs/branch/master)

@@ -12,9 +12,3 @@ > Grunt and PhantomJS, sitting in a tree.

### Options
* `timeout`: PhantomJS' timeout, in milliseconds.
* `inject`: JavaScript to inject into the page.
* `page`: an object of options for the PhantomJS [`page` object](https://github.com/ariya/phantomjs/wiki/API-Reference-WebPage).
* `screenshot`: saves a screenshot on failure
## An inline example

@@ -109,2 +103,83 @@

## API
### phantomjs.halt()
Call this when everything has finished successfully, or when something horrible happens, and you need to clean up and abort.
### phantomjs.spawn(pageURL, options)
Spawn a `PhantomJS` process. The method returns a reference to the spawned process.
This method has the following arguments:
#### pageURL
Type: `string`
Default: no default value, the user has to set it explicitly.
URL or path to the page .html test file to run.
#### Options
Type: `object`
The options object has these possible properties:
##### done
Type: `function`
Default: no default value, the user has to set it explicitly.
The callback to call when the task is done.
##### failCode
Type: `number`
Default: 0
The error code to exit with when an Error occurs.
##### killTimeout
Type: `number`
Default: `1000` ms
The timeout in milliseconds after which the PhantomJS process will be killed.
##### options (PhantomJS options)
Type: `object`
Default: `{}`
Additional options to passe to `PhantomJS`. This object has the following properties:
###### timeout
Type: `number`
Default: `undefined`
PhantomJS' timeout, in milliseconds.
###### inject
Type: `string|array`
Default: `undefined`
One or multiple (array) JavaScript file names to inject into the page.
###### page
Type: `object`
Default: `undefined`
An object of options for the PhantomJS [`page` object](https://github.com/ariya/phantomjs/wiki/API-Reference-WebPage).
###### screenshot
Type: `boolean`
Default: `undefined`
Saves a screenshot on failure
## OS Dependencies

@@ -111,0 +186,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc