Skip to content

Instantly share code, notes, and snippets.

@franrios
Created April 9, 2016 14:29
Show Gist options
  • Save franrios/15247216b7afddcae55bf807222104c2 to your computer and use it in GitHub Desktop.
Save franrios/15247216b7afddcae55bf807222104c2 to your computer and use it in GitHub Desktop.
const gulp = require('gulp')
const mocha = require('gulp-mocha')
const bg = require('gulp-bg')
var bgstart
gulp.task('start', bgstart = bg('node', './index.js'))
gulp.task('test', ['start'], function () {
return gulp.src('./test/test.js', {read: false})
.pipe(mocha({reporter: 'nyan'}))
.once('end', function () {
bgstart.setCallback(function () { process.exit(0) })
bgstart.stop(0)
})
.once('error', function () {
bgstart.setCallback(function () { process.exit(0) })
bgstart.stop(0)
})
})
gulp.task('default', ['start', 'test'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment