Skip to content

Commit 075e66c

Browse files
committed
fix(seed): gulp task test:seed would hang on the gulp node process and not exit
the mongoose and sequelize connections were not closing, therefore leaving an event listener open for connections and hanging the node.js process waiting for more work. By closing the connections on both the gulp process is able to quit after performing the seed tasks.
1 parent 9dfb3df commit 075e66c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

server/gulpfile.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,29 +218,36 @@ gulp.task('ava:test:integration', function() {
218218
});
219219
});
220220

221+
// Connects to Mongoose based on environment settings and seeds the database, performing
222+
// a drop of the mongo database to clear it out
221223
gulp.task('seed:mongoose', function(done) {
222224
const mongoose = require('./config/lib/mongoose');
223225

224226
mongoose.connect()
225227
.then(mongoose.seed)
228+
.then(mongoose.disconnect)
226229
.then(function() {
227230
done();
228231
});
229232
});
230233

234+
// Connects to an SQL database, drop and re-create the schemas
231235
gulp.task('seed:sequelize', function(done) {
232236
const sequelize = require('./config/lib/sequelize');
233237

234238
sequelize.seed()
235239
.then(function() {
240+
sequelize.sequelize.close();
236241
done();
237-
});
242+
});
238243
});
239244

245+
// Performs database seeding, used in test environments and related tasks
240246
gulp.task('test:seed', function(done) {
241247
runSequence('seed:mongoose', 'seed:sequelize', done);
242248
});
243249

250+
// Run Integration Tests
244251
gulp.task('test:integration', function(done) {
245252
runSequence('env:test', 'server:bootstrap', 'ava:test:integration', done);
246253
});

0 commit comments

Comments
 (0)