diff --git a/Makefile b/Makefile index 97f984102..084a72a1f 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ b benchmark benchmarks: .PHONY: l ld leak leak-detection l ld leak leak-detection: + npm i @airbnb/node-memwatch --no-save || npm i memwatch-next --no-save @ITERATIONS=$(ITERATIONS) $(TESTER) leak-detection \ --recursive \ --reporter spec \ diff --git a/leak-detection/leak-detector.test.js b/leak-detection/leak-detector.test.js index 907583d6b..d757af118 100644 --- a/leak-detection/leak-detector.test.js +++ b/leak-detection/leak-detector.test.js @@ -5,7 +5,13 @@ 'use strict'; -var memwatch = require('memwatch-next'); +var memwatch; + +try { + memwatch = require('@airbnb/node-memwatch'); +} catch (e) { + memwatch = require('memwatch-next'); +} var sinon = require('sinon'); describe('leak detector', function() { diff --git a/lib/mongodb.js b/lib/mongodb.js index c8b3aaffa..f90ae37a7 100644 --- a/lib/mongodb.js +++ b/lib/mongodb.js @@ -49,13 +49,17 @@ exports.generateMongoDBURL = generateMongoDBURL; * Generate the mongodb URL from the options */ function generateMongoDBURL(options) { + // See https://docs.mongodb.com/manual/reference/connection-string/#dns-seedlist-connection-format + // It can be `mongodb+srv` now. + options.protocol = options.protocol || 'mongodb'; options.hostname = options.hostname || options.host || '127.0.0.1'; options.port = options.port || 27017; options.database = options.database || options.db || 'test'; var username = options.username || options.user; if (username && options.password) { return ( - 'mongodb://' + + options.protocol + + '://' + username + ':' + options.password + @@ -68,7 +72,8 @@ function generateMongoDBURL(options) { ); } else { return ( - 'mongodb://' + + options.protocol + + '://' + options.hostname + ':' + options.port + diff --git a/package.json b/package.json index e0a4b2fdb..afc6ed3ff 100644 --- a/package.json +++ b/package.json @@ -26,23 +26,22 @@ ], "license": "MIT", "dependencies": { - "async": "^2.6.0", + "async": "^2.6.1", "bson": "^1.0.6", "debug": "^3.1.0", "loopback-connector": "^4.5.0", - "mongodb": "^3.0.1", + "mongodb": "^3.1.4", "strong-globalize": "^4.1.1" }, "devDependencies": { "benchmark": "^2.1.4", - "bluebird": "^3.5.1", + "bluebird": "^3.5.2", "eslint": "^5.1.0", "eslint-config-loopback": "^10.0.0", - "loopback-datasource-juggler": "^3.0.0", - "memwatch-next": "^0.3.0", + "loopback-datasource-juggler": "^3.23.0", "mocha": "^5.2.0", "rc": "^1.2.8", - "semver": "^5.5.0", + "semver": "^5.5.1", "should": "^13.2.1", "sinon": "^6.1.3" }