Skip to content

Commit ebc9a01

Browse files
pedro-victordiegohaz
authored andcommitted
Update project dependencies (#174)
* Update project dependencies - Mongoose: 4.12 -> 5.1 - ESLint: 4.4 -> 4.19 - Mockgoose: dropped in favor of mongodb-memory-server * Upgrade TravisCI Node versions * Upgrade gulp-nsp (and consequently nsp itself) * Disable NSP * Add Node v6 and v7 to TravisCI * Fix tests by waiting for mongoose/mongodb to disconnect
1 parent 4a6c3d5 commit ebc9a01

8 files changed

Lines changed: 314 additions & 513 deletions

File tree

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ cache:
33
directories:
44
- node_modules
55
node_js:
6-
- v4
7-
- v5
86
- v6
7+
- v7
8+
- v8
9+
- v9
910
addons:
1011
apt:
1112
sources:

generators/app/templates/_package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@
2525
"babel-jest": "^20.0.3",
2626
"cross-env": "^5.0.5",
2727
"dotenv-safe": "^4.0.3",
28-
"eslint": "^4.4.1",
29-
"eslint-config-standard": "^10.2.1",
30-
"eslint-plugin-promise": "^3.0.0",
31-
"eslint-plugin-standard": "^3.0.1",
28+
"eslint": "^4.19.1",
29+
"eslint-config-standard": "^11.0.0",
30+
"eslint-plugin-import": "^2.11.0",
31+
"eslint-plugin-node": "^6.0.1",
32+
"eslint-plugin-promise": "^3.7.0",
33+
"eslint-plugin-standard": "^3.1.0",
3234
"jest-cli": "^20.0.4",
33-
"mockgoose": "^6.0.8",
35+
"mongodb-memory-server": "^1.7.3",
3436
"nock": "^9.0.2",
3537
"nodemon": "^1.10.2",
3638
"opn-cli": "^3.1.0",
@@ -58,9 +60,9 @@
5860
<%_ if (generateAuthApi) { _%>
5961
"jsonwebtoken": "^8.1.0",
6062
<%_ } _%>
61-
"mongoose": "^4.12.4",
63+
"mongoose": "^5.1.0",
6264
"mongoose-create-unique": "^0.4.4",
63-
"mongoose-keywords": "^0.3.2",
65+
"mongoose-keywords": "^0.4.0",
6466
"morgan": "^1.7.0",
6567
<%_ if (generateAuthApi) { _%>
6668
"passport": "^0.4.0",

generators/app/templates/src/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import api from './api'
77
const app = express(apiRoot, api)
88
const server = http.createServer(app)
99

10-
mongoose.connect(mongo.uri, { useMongoClient: true })
10+
mongoose.connect(mongo.uri)
1111
mongoose.Promise = Promise
1212

1313
setImmediate(() => {

generators/app/templates/src/config.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,7 @@ const config = {
4444
}
4545
}
4646
},
47-
test: {
48-
mongo: {
49-
uri: 'mongodb://localhost/<%= slug %>-test',
50-
options: {
51-
debug: false
52-
}
53-
}
54-
},
47+
test: { },
5548
development: {
5649
mongo: {
5750
uri: 'mongodb://localhost/<%= slug %>-dev',

generators/app/templates/test/setup.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { EventEmitter } from 'events'
2-
import mockgoose from 'mockgoose'
2+
import MongodbMemoryServer from 'mongodb-memory-server'
33
import mongoose from '../<%= srcDir %>/services/mongoose'
4-
import { mongo } from '../<%= srcDir %>/config'
54

65
EventEmitter.defaultMaxListeners = Infinity
76
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000
@@ -22,13 +21,19 @@ global.TypeError = TypeError
2221
global.parseInt = parseInt
2322
global.parseFloat = parseFloat
2423

24+
let mongoServer
25+
2526
beforeAll(async () => {
26-
await mockgoose(mongoose)
27-
mongoose.connect(mongo.uri)
27+
mongoServer = new MongodbMemoryServer()
28+
const mongoUri = await mongoServer.getConnectionString()
29+
await mongoose.connect(mongoUri, (err) => {
30+
if (err) console.error(err)
31+
})
2832
})
2933

30-
afterAll(() => {
31-
mongoose.disconnect()
34+
afterAll(async () => {
35+
await mongoose.disconnect()
36+
await mongoServer.stop()
3237
})
3338

3439
afterEach(async () => {

gulpfile.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var eslint = require('gulp-eslint');
55
var excludeGitignore = require('gulp-exclude-gitignore');
66
var mocha = require('gulp-mocha');
77
var istanbul = require('gulp-istanbul');
8-
var nsp = require('gulp-nsp');
8+
// var nsp = require('gulp-nsp');
99
var plumber = require('gulp-plumber');
1010
var coveralls = require('gulp-coveralls');
1111

@@ -17,9 +17,9 @@ gulp.task('lint', function () {
1717
.pipe(eslint.failAfterError());
1818
});
1919

20-
gulp.task('nsp', function (cb) {
21-
nsp({package: path.resolve('package.json')}, cb);
22-
});
20+
// gulp.task('nsp', function (cb) {
21+
// nsp({package: path.resolve('package.json')}, cb);
22+
// });
2323

2424
gulp.task('pre-test', function () {
2525
return gulp.src(['generators/!(templates)**/index.js'])
@@ -58,5 +58,5 @@ gulp.task('coveralls', ['test'], function () {
5858
.pipe(coveralls());
5959
});
6060

61-
gulp.task('prepublish', ['nsp']);
61+
gulp.task('prepublish', [/* 'nsp' */]);
6262
gulp.task('default', ['test', 'coveralls']);

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,13 @@
7474
"gulp-istanbul": "^1.0.0",
7575
"gulp-line-ending-corrector": "^1.0.1",
7676
"gulp-mocha": "^2.0.0",
77-
"gulp-nsp": "^2.1.0",
7877
"gulp-plumber": "^1.0.0",
7978
"jest-cli": "^20.0.4",
8079
"jsonwebtoken": "^8.1.0",
81-
"mockgoose": "^6.0.8",
82-
"mongoose": "^4.12.4",
80+
"mongodb-memory-server": "^1.7.3",
81+
"mongoose": "^5.1.0",
8382
"mongoose-create-unique": "^0.4.4",
84-
"mongoose-keywords": "^0.3.2",
83+
"mongoose-keywords": "^0.4.0",
8584
"morgan": "^1.7.0",
8685
"nock": "^9.0.2",
8786
"nodemon": "^1.10.2",

0 commit comments

Comments
 (0)