var gulp = require('gulp');
var browserify = require('gulp-browserify');
var uglify = require('gulp-uglify');
var size = require('gulp-size');
var rename = require('gulp-rename');
var mocha = require('gulp-mocha');
var karma = require('karma').server;
var args = require('yargs').argv;


function printError(error) {
  console.error('\nError:', error.plugin);
  console.error(error.message);
}

function printEvent(event) {
  console.log('File', event.type +':', event.path);
}

gulp.task('build', function() {
  gulp.src('index.js')
      .pipe(browserify({
        debug: true,
        standalone: 'gremlin'
      }))
      .pipe(rename('gremlin.js'))
      .pipe(gulp.dest('./'))
      .pipe(size({ showFiles: true }))
      // Minified version
      .pipe(uglify())
      .pipe(rename('gremlin.min.js'))
      .pipe(gulp.dest('./'))
      .pipe(size({ showFiles: true }));
});

gulp.task('test-node', function() {
  require('chai').should();

  return gulp.src('test/**/*')
      .pipe(mocha({
        reporter: 'spec',
        bail: !!args.bail
      }))
      .on('error', printError);
});

gulp.task('test-browsers', function(done) {
  var karmaCommonConf = {
    browsers: ['Chrome', 'Firefox', 'Safari'],
    frameworks: ['mocha', 'chai', 'browserify'],
    preprocessors: {
      'test/*': ['browserify']
    },
    files: [
      'test/**/*.js'
    ],
    browserify: {
      watch: true // Watches dependencies only (Karma watches the tests)
    }
  };

  karma.start(karmaCommonConf, done);
});

gulp.task('watch', function() {
  gulp.watch(['src/**/*', 'test/**/*', 'index.js'], ['test-node'])
    .on('change', printEvent);
});

gulp.task('default', ['build']);

gulp.task('dev', ['test-browsers', 'test-node', 'watch']);

@@ -1,12 +1,26 @@
+'use strict';%0A
 var gulp = r
@@ -900,25 +900,77 @@
 p.task('test
--
+', %5B'test:node', 'test:browsers'%5D);%0A%0Agulp.task('test:
 node', funct
@@ -1167,25 +1167,25 @@
 p.task('test
--
+:
 browsers', f
@@ -1764,30 +1764,8 @@
 test
--browsers', 'test-node
 ', '

Add gulp test task