Skip to content

Commit d3f5ff7

Browse files
committed
Merge pull request #1536 from david-mohr/gulp-mocha-close-conn
fix(gulp:mocha): have tests clean up once complete
2 parents fcad9c1 + 93dec12 commit d3f5ff7

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Diff for: app/templates/gulpfile.babel(gulp).js

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ const paths = {
4242
scripts: [`${serverPath}/**/!(*.spec|*.integration).js`],
4343
json: [`${serverPath}/**/*.json`],
4444
test: {
45-
integration: `${serverPath}/**/*.integration.js`,
46-
unit: `${serverPath}/**/*.spec.js`
45+
integration: [`${serverPath}/**/*.integration.js`, 'mocha.global.js'],
46+
unit: [`${serverPath}/**/*.spec.js`, 'mocha.global.js']
4747
}
4848
},
4949
karma: 'karma.conf.js',

Diff for: app/templates/mocha.global(gulp).js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import app from './';<% if (filters.mongoose) { %>
2+
import mongoose from 'mongoose';<% } %>
3+
4+
after(function(done) {
5+
app.angularFullstack.on('close', () => done());<% if (filters.mongoose) { %>
6+
mongoose.connection.close();<% } %>
7+
app.angularFullstack.close();
8+
});

Diff for: app/templates/server/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ require('./routes')(app);
3434

3535
// Start server
3636
function startServer() {
37-
server.listen(config.port, config.ip, function() {
37+
app.angularFullstack = server.listen(config.port, config.ip, function() {
3838
console.log('Express server listening on %d, in %s mode', config.port, app.get('env'));
3939
});
4040
}

0 commit comments

Comments
 (0)