File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff 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
193195gulp . 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
200203gulp . 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} ) ;
You can’t perform that action at this time.
0 commit comments