diff --git a/lib/utils.js b/lib/utils.js index fe827e23..306a1764 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,6 +1,5 @@ exports.createPromiseCallback = createPromiseCallback; -var Promise = global.Promise = require('bluebird'); function createPromiseCallback() { var cb; @@ -12,7 +11,7 @@ function createPromiseCallback() { return cb; } - var promise = new Promise(function(resolve, reject) { + var promise = new global.Promise(function(resolve, reject) { cb = function(err, data) { if (err) return reject(err); return resolve(data); diff --git a/test/support.js b/test/support.js index 0f925a38..9e2d791f 100644 --- a/test/support.js +++ b/test/support.js @@ -47,3 +47,7 @@ assert.isFunc = function(obj, name) { assert(obj, 'cannot assert function ' + name + ' on object that doesnt exist'); assert(typeof obj[name] === 'function', name + ' is not a function'); }; + +if (!('Promise' in global)) { + global.Promise = require('bluebird'); +}