mongodb-memory-server
Advanced tools
Comparing version 1.9.1 to 1.9.2
@@ -26,5 +26,5 @@ 'use strict'; | ||
var _fsExtra = require('fs-extra'); | ||
var _fs = require('fs'); | ||
var _fsExtra2 = _interopRequireDefault(_fsExtra); | ||
var _fs2 = _interopRequireDefault(_fs); | ||
@@ -118,3 +118,3 @@ var _md5File = require('md5-file'); | ||
case 9: | ||
_fsExtra2.default.unlinkSync(mongoDBArchive); | ||
_fs2.default.unlinkSync(mongoDBArchive); | ||
@@ -159,28 +159,30 @@ if (!this.locationExists(mongodPath)) { | ||
}); | ||
_context2.next = 3; | ||
return _fsExtra2.default.ensureDir(this.downloadDir); | ||
case 3: | ||
_context2.next = 5; | ||
if (!_fs2.default.existsSync(this.downloadDir)) { | ||
_fs2.default.mkdirSync(this.downloadDir); | ||
} | ||
_context2.next = 4; | ||
return mbdUrl.getDownloadUrl(); | ||
case 5: | ||
case 4: | ||
downloadUrl = _context2.sent; | ||
_context2.next = 8; | ||
_context2.next = 7; | ||
return this.download(downloadUrl); | ||
case 8: | ||
case 7: | ||
mongoDBArchive = _context2.sent; | ||
_context2.next = 11; | ||
_context2.next = 10; | ||
return this.download(`${downloadUrl}.md5`); | ||
case 11: | ||
case 10: | ||
mongoDBArchiveMd5 = _context2.sent; | ||
_context2.next = 14; | ||
_context2.next = 13; | ||
return this.checkMd5(mongoDBArchiveMd5, mongoDBArchive); | ||
case 14: | ||
case 13: | ||
return _context2.abrupt('return', mongoDBArchive); | ||
case 15: | ||
case 14: | ||
case 'end': | ||
@@ -203,3 +205,3 @@ return _context2.stop(); | ||
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee3(mongoDBArchiveMd5, mongoDBArchive) { | ||
var signatureContent, md5Remote, md5Local; | ||
var signatureContent, m, md5Remote, md5Local; | ||
return _regenerator2.default.wrap(function _callee3$(_context3) { | ||
@@ -209,12 +211,9 @@ while (1) { | ||
case 0: | ||
_context3.next = 2; | ||
return _fsExtra2.default.readFile(mongoDBArchiveMd5); | ||
case 2: | ||
signatureContent = _context3.sent.toString('UTF-8'); | ||
md5Remote = signatureContent.match(/(.*?)\s/)[1]; | ||
signatureContent = _fs2.default.readFileSync(mongoDBArchiveMd5).toString('UTF-8'); | ||
m = signatureContent.match(/(.*?)\s/); | ||
md5Remote = m ? m[1] : null; | ||
md5Local = _md5File2.default.sync(mongoDBArchive); | ||
if (!(md5Remote !== md5Local)) { | ||
_context3.next = 7; | ||
_context3.next = 6; | ||
break; | ||
@@ -225,3 +224,3 @@ } | ||
case 7: | ||
case 6: | ||
case 'end': | ||
@@ -306,6 +305,7 @@ return _context3.stop(); | ||
this.debug(`extract(): ${extractDir}`); | ||
_context5.next = 5; | ||
return _fsExtra2.default.ensureDir(extractDir); | ||
case 5: | ||
if (!_fs2.default.existsSync(extractDir)) { | ||
_fs2.default.mkdirSync(extractDir); | ||
} | ||
filter = void 0; | ||
@@ -325,3 +325,3 @@ | ||
_context5.next = 9; | ||
_context5.next = 8; | ||
return (0, _decompress2.default)(mongoDBArchive, extractDir, { | ||
@@ -337,5 +337,5 @@ // extract only `bin/mongod` file | ||
case 9: | ||
case 8: | ||
if (this.locationExists(_path2.default.resolve(this.downloadDir, this.version, binaryName))) { | ||
_context5.next = 11; | ||
_context5.next = 10; | ||
break; | ||
@@ -346,6 +346,6 @@ } | ||
case 11: | ||
case 10: | ||
return _context5.abrupt('return', extractDir); | ||
case 12: | ||
case 11: | ||
case 'end': | ||
@@ -375,3 +375,3 @@ return _context5.stop(); | ||
return _context6.abrupt('return', new Promise(function (resolve, reject) { | ||
var fileStream = _fsExtra2.default.createWriteStream(tempDownloadLocation); | ||
var fileStream = _fs2.default.createWriteStream(tempDownloadLocation); | ||
@@ -386,7 +386,6 @@ var req = _https2.default.get(httpOptions, function (response) { | ||
fileStream.on('finish', function () { | ||
fileStream.close(function () { | ||
_fsExtra2.default.renameSync(tempDownloadLocation, downloadLocation); | ||
_this.debug(`renamed ${tempDownloadLocation} to ${downloadLocation}`); | ||
resolve(downloadLocation); | ||
}); | ||
fileStream.close(); | ||
_fs2.default.renameSync(tempDownloadLocation, downloadLocation); | ||
_this.debug(`renamed ${tempDownloadLocation} to ${downloadLocation}`); | ||
resolve(downloadLocation); | ||
}); | ||
@@ -438,3 +437,3 @@ | ||
try { | ||
_fsExtra2.default.lstatSync(location); | ||
_fs2.default.lstatSync(location); | ||
return true; | ||
@@ -441,0 +440,0 @@ } catch (e) { |
{ | ||
"name": "mongodb-memory-server", | ||
"version": "1.9.1", | ||
"version": "1.9.2", | ||
"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.", | ||
@@ -54,3 +54,2 @@ "main": "lib/index.js", | ||
"decompress": "^4.2.0", | ||
"fs-extra": "^6.0.1", | ||
"get-port": "^3.2.0", | ||
@@ -57,0 +56,0 @@ "getos": "^3.1.0", |
@@ -8,3 +8,2 @@ # mongodb-memory-server | ||
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/nodkz/mongodb-memory-server.svg)](https://greenkeeper.io/) | ||
@@ -11,0 +10,0 @@ This package spins up a actual/real MongoDB Server programmatically from node for testing or mocking during development. By default it holds the data in memory. Fresh spinned up `mongod` process takes about 7Mb of memory. The server will allow you to connect your favorite ODM or client library to the MongoDB Server and run integration tests isolated from each other. |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
11
103944
1511
294
- Removedfs-extra@^6.0.1
- Removedfs-extra@6.0.1(transitive)
- Removedjsonfile@4.0.0(transitive)
- Removeduniversalify@0.1.2(transitive)