Skip to content

Commit 9dfb3df

Browse files
committed
docs(gulpfile): adding comments on gulp tasks
1 parent ae3eaf3 commit 9dfb3df

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

server/gulpfile.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,22 +190,30 @@ gulp.task('test', function (done) {
190190
runSequence('env:test', 'test:server', done);
191191
});
192192

193+
// Bootstrap the server instance
194+
// Common use case is to run API tests on real instantiated models and db
193195
gulp.task('server:bootstrap', function(done) {
194196
const app = require('./config/lib/app');
195197
app.start().then(function() {
196198
done();
197199
});
198200
});
199201

202+
// Launch Ava's integration tests
200203
gulp.task('ava:test:integration', function() {
201204
return gulp.src(defaultAssets.server.test)
202205
// gulp-ava needs filepaths so you can't have any plugins before it
203206
.pipe(plugins.ava({verbose: true}))
204207
.on('error', function(err) {
208+
// On errors emitted by Ava we display them and exit with a non-zero error code
209+
// to fail the build
205210
console.log(err.message);
206211
process.exit(1);
207212
})
208213
.on('end', function() {
214+
// Because this test depends on `server:bootstrap` which opens an even listener
215+
// for server connections, it is required to force an exit, otherwise the gulp
216+
// process will stay open, waiting to process connections due to `server:bootstrap`
209217
process.exit(0);
210218
});
211219
});

0 commit comments

Comments
 (0)