Skip to content

Commit

Permalink
docs(gulpfile): adding comments on gulp tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
lirantal committed Jan 5, 2017
1 parent ae3eaf3 commit 9dfb3df
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions server/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,22 +190,30 @@ gulp.task('test', function (done) {
runSequence('env:test', 'test:server', done);
});

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

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

0 comments on commit 9dfb3df

Please sign in to comment.