Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

phantom-workers

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

phantom-workers - npm Package Compare versions

Comparing version
0.3.3
to
0.4.0
+9
test/test-script/env.js
var port = require("system").env['PHANTOM_WORKER_PORT'];
var host = require("system").env['PHANTOM_WORKER_HOST'];
var env = require("system").env['PHANTOM_TEST_ENV'];
require('webserver').create().listen(host + ':' + port, function (req, res) {
res.statusCode = 200;
res.write(JSON.stringify({value: env}));
res.close();
});
+3
-1

@@ -18,2 +18,3 @@ /*!

this.options = options || {};
this.options.workerEnv = this.options.workerEnv || {};
this.options.numberOfWorkers = this.options.numberOfWorkers || numCPUs;

@@ -49,3 +50,4 @@ this.options.timeout = this.options.timeout || 180000;

portRightBoundary: self.options.portRightBoundary,
phantomPath: self.options.phantomPath
phantomPath: self.options.phantomPath,
env: self.options.workerEnv
}));

@@ -52,0 +54,0 @@ self._phantomInstances[i].start(function(err) {

@@ -85,3 +85,3 @@ var childProcess = require('child_process'),

var childOpts = {
env: {}
env: self.options.env
};

@@ -88,0 +88,0 @@

{
"name": "phantom-workers",
"version": "0.3.3",
"version": "0.4.0",
"author": {

@@ -5,0 +5,0 @@ "name": "Jan Blaha",

@@ -61,3 +61,4 @@ #phantom-workers

`phantomPath` - path to the phantomjs library. If not specified, this will use the version of phantom declared in the `optionalDependencies` in `package.json`<br/>
`proxy,proxy-type,proxy-auth` - see phantomjs arguments for proxy setting details
`proxy,proxy-type,proxy-auth` - see phantomjs arguments for proxy setting details
`workerEnv` - object with additional environment variables passed to the phantom process

@@ -64,0 +65,0 @@ ##phantomjs2

@@ -181,2 +181,24 @@ var should = require("should"),

});
it("should be able to provide custom worker env variables", function (done) {
phantomManager = new PhantomManager({
pathToPhantomScript: path.join(__dirname, "test-script", "env.js"),
workerEnv: {
"PHANTOM_TEST_ENV": "test"
},
numberOfWorkers: 1
});
phantomManager.start(function(err) {
if (err)
return done(err);
phantomManager.execute({}, function (err, res) {
if (err)
return done(err);
res.value.should.be.eql('test');
done();
});
});
});
});