mongodb-memory-server
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -46,7 +46,5 @@ 'use strict'; | ||
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee() { | ||
var _this = this; | ||
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var _opts$downloadDir, downloadDir, _opts$platform, platform, _opts$arch, arch, _opts$version, version, _opts$http, http, debug; | ||
var _opts$downloadDir, downloadDir, _opts$platform, platform, _opts$arch, arch, _opts$version, version, _opts$http, http, debug, downloader, releaseDir; | ||
@@ -76,3 +74,3 @@ return regeneratorRuntime.wrap(function _callee$(_context) { | ||
debug(`MongoBinary: found cached binary path for ${version}`); | ||
_context.next = 11; | ||
_context.next = 21; | ||
break; | ||
@@ -95,43 +93,42 @@ | ||
retries: { retries: 180, factor: 1, minTimeout: 1000 } | ||
}, function (err, releaseLock) { | ||
debug('MongoBinary: Download lock created'); | ||
}, function (err) { | ||
if (err) reject(err);else resolve(); | ||
}); | ||
}); | ||
// cache may be populated by previous process | ||
// check again | ||
if (_this.cache[version]) { | ||
debug(`MongoBinary: found cached binary path for ${version}`); | ||
resolve(_this.cache[version]); | ||
} | ||
case 11: | ||
if (this.cache[version]) { | ||
_context.next = 20; | ||
break; | ||
} | ||
if (err) { | ||
reject(err); | ||
return; | ||
} | ||
downloader = new _mongodbDownload.MongoDBDownload({ | ||
downloadDir, | ||
platform, | ||
arch, | ||
version, | ||
http | ||
}); | ||
var downloader = new _mongodbDownload.MongoDBDownload({ | ||
downloadDir, | ||
platform, | ||
arch, | ||
version, | ||
http | ||
}); | ||
downloader.debug = debug; | ||
downloader.debug = debug; | ||
_context.next = 16; | ||
return downloader.downloadAndExtract(); | ||
downloader.downloadAndExtract().then(function (releaseDir) { | ||
releaseLock(function (e) { | ||
debug(e ? `MongoBinary: Error when removing download lock ${e}` : `MongoBinary: Download lock removed`); | ||
}); | ||
return _this.findBinPath(releaseDir); | ||
}).then(function (binPath) { | ||
_this.cache[version] = binPath; | ||
resolve(); | ||
}).catch(function (e) { | ||
debug(`MongoBinary: Error with mongod binary path: ${e}`); | ||
reject(e); | ||
}); | ||
}); | ||
case 16: | ||
releaseDir = _context.sent; | ||
_context.next = 19; | ||
return this.findBinPath(releaseDir); | ||
case 19: | ||
this.cache[version] = _context.sent; | ||
case 20: | ||
// remove lock | ||
_properLockfile2.default.unlock(downloadDir, function (err) { | ||
debug(err ? `MongoBinary: Error when removing download lock ${err}` : `MongoBinary: Download lock removed`); | ||
}); | ||
case 11: | ||
case 21: | ||
@@ -141,3 +138,3 @@ debug(`MongoBinary: Mongod binary path: ${this.cache[version]}`); | ||
case 13: | ||
case 23: | ||
case 'end': | ||
@@ -159,3 +156,3 @@ return _context.stop(); | ||
value: function findBinPath(releaseDir) { | ||
var _this2 = this; | ||
var _this = this; | ||
@@ -166,3 +163,3 @@ return new Promise(function (resolve, reject) { | ||
reject(err); | ||
} else if (_this2.hasValidBinPath(files) === true) { | ||
} else if (_this.hasValidBinPath(files) === true) { | ||
var resolvedBinPath = files[0]; | ||
@@ -169,0 +166,0 @@ resolve(resolvedBinPath); |
{ | ||
"name": "mongodb-memory-server", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "In-memory MongoDB Server. Designed with testing in mind, the server will allow you to connect your favourite ODM or client library to the MongoDB Server and run integration tests isolated from each other.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
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
56587
708