node-horseman
Advanced tools
Comparing version 3.0.0 to 3.0.1
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
## 3.0.1 - 2016-04-12 | ||
### Fixed | ||
- .injectJs() now properly rejects when it fails | ||
- #158 - bug with `injectBluebird` option | ||
## 3.0.0 - 2016-04-06 | ||
@@ -5,0 +10,0 @@ ### Added |
@@ -555,8 +555,15 @@ 'use strict'; | ||
var self = this; | ||
return this.ready.then(function() { | ||
return HorsemanPromise.fromCallback(function(done) { | ||
debug('.injectJs()', file); | ||
return self.page.injectJs(file, done); | ||
return this.ready | ||
.then(function() { | ||
return HorsemanPromise.fromCallback(function(done) { | ||
debug('.injectJs()', file); | ||
return self.page.injectJs(file, done); | ||
}); | ||
}) | ||
.tap(function(successful) { | ||
if (!successful) { | ||
var err = new Error('failed to inject ' + file); | ||
return HorsemanPromise.reject(err); | ||
} | ||
}); | ||
}); | ||
}; | ||
@@ -563,0 +570,0 @@ |
@@ -299,5 +299,9 @@ 'use strict'; | ||
return HorsemanPromise.fromCallback(function(done) { | ||
page.injectJs(jQueryLocation, done); | ||
return page.injectJs(jQueryLocation, done); | ||
}) | ||
.tap(function() { | ||
.tap(function(successful) { | ||
if (!successful) { | ||
var err = new Error('jQuery injection failed'); | ||
return HorsemanPromise.reject(err); | ||
} | ||
debug('injected jQuery'); | ||
@@ -325,10 +329,12 @@ }); | ||
var bluebirdLocation = path.join(__dirname, | ||
'../node_modules/bluebird/js/browser/bluebird' + | ||
(self.options.bluebirdDebug ? '' : '.min') + | ||
'.js'); | ||
var bbLoc = 'bluebird/js/browser/bluebird' + | ||
(self.options.bluebirdDebug ? '' : '.min') + '.js'; | ||
return HorsemanPromise.fromCallback(function(done) { | ||
return page.injectJs(bluebirdLocation, done); | ||
return page.injectJs(require.resolve(bbLoc), done); | ||
}) | ||
.tap(function() { | ||
.tap(function(successful) { | ||
if (!successful) { | ||
var err = new Error('bluebird injection failed'); | ||
return HorsemanPromise.reject(err); | ||
} | ||
debug('injected bluebird'); | ||
@@ -335,0 +341,0 @@ }); |
{ | ||
"name": "node-horseman", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Run PhantomJS from Node", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -708,2 +708,14 @@ 'use strict'; | ||
it('should reject when inject javascript fails', function() { | ||
var horseman = new Horseman({ | ||
timeout: defaultTimeout, | ||
injectJquery: bool | ||
}); | ||
return horseman | ||
.open(serverUrl) | ||
.injectJs('test/files/not_a_real_file.js') | ||
.close() | ||
.should.be.rejected(); | ||
}); | ||
it('should include javascript', function() { | ||
@@ -710,0 +722,0 @@ var horseman = new Horseman({ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
229512
4297
7