diff --git a/index.js b/index.js index 7e7de09..bde6fbf 100644 --- a/index.js +++ b/index.js @@ -43,10 +43,10 @@ Seeder.prototype.connect = function(...params) { cb = params[1]; } else if (params.length == 3) { db = params[0]; - opts = params[1]; - cb = params[2]; + opts = params[1]; + cb = params[2]; } else { - console.error('Pass either 2 or 3 arguments to seeder.connect'); + console.error('Pass either 2 or 3 arguments to seeder.connect'); process.exit(1); } @@ -59,14 +59,16 @@ Seeder.prototype.connect = function(...params) { cb(); } else { if (opts) { - mongoose.connect(db, opts, function (err) { - afterConnect(_this, err, cb); - }); + opts.useNewUrlParser = true; } else { - mongoose.connect(db, function (err) { - afterConnect(_this, err, cb); - }); + opts = { + useNewUrlParser: true + }; } + + mongoose.connect(db, opts, function (err) { + afterConnect(_this, err, cb); + }); } }; diff --git a/package.json b/package.json index b8e1f00..748c96d 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Seed data population for Mongoose", "main": "index.js", "scripts": { - "test": "mocha test/**/*.js" + "test": "mocha --exit test/**/*.js" }, "repository": { "type": "git", @@ -28,14 +28,14 @@ }, "homepage": "https://github.com/seanemmer/mongoose-seed#readme", "dependencies": { - "async": "~1.2.0", - "chalk": "~1.0.0", - "lodash": "~4.17.10", - "path": "~0.11.14" + "async": "~2.6.1", + "chalk": "~2.4.2", + "lodash": "~4.17.11", + "path": "~0.12.7" }, "devDependencies": { - "chai": "^3.5.0", - "mocha": "^3.0.0", - "mongoose": "^4.5.8" + "chai": "^4.2.0", + "mocha": "^5.2.0", + "mongoose": "^5.4.8" } }