Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Gulp now closes the mongoose connection
Browse files Browse the repository at this point in the history
Fixes #450.
  • Loading branch information
ilanbiala committed Mar 6, 2015
1 parent e954a20 commit 6cce3d0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,20 @@ gulp.task('less', function () {
});

// Connect to MongoDB using the mongoose module
gulp.task('mongoose', function (done) {
gulp.task('openMongoose', function (done) {
var mongoose = require('./config/lib/mongoose.js');

mongoose.connect(function(db) {
done();
});
});

gulp.task('closeMongoose', function (done) {
var mongoose = require('./config/lib/mongoose.js');

mongoose.disconnect();
});

// Mocha tests task
gulp.task('mocha', function () {
return gulp.src(testAssets.tests.server)
Expand Down Expand Up @@ -168,7 +174,7 @@ gulp.task('build', function(done) {

// Run the project tests
gulp.task('test', function(done) {
runSequence('env:test', 'mongoose', ['karma', 'mocha'], done);
runSequence('env:test', 'openMongoose', ['karma', 'mocha'], 'closeMongoose', done);
});

// Run the project in development mode
Expand Down

0 comments on commit 6cce3d0

Please sign in to comment.