var mocha = require('gulp-mocha');
require('babel-register');
require('../test/utils/dom.js');

module.exports = function(gulp, config) {
  gulp.task('test', ['build:lib'], function() {
    var reporter = process.argv[process.argv.indexOf('--reporter') + 1];

    return gulp.src(config.paths.test, {read: false})
      .pipe(mocha({reporter: reporter}))
      .on('error', function(err) {
        this.emit('end');
      });
  });

  gulp.task('watch:tests', ['test'], function() {
    gulp.watch([config.paths.src, config.paths.test], ['test']);
  });
};

@@ -199,24 +199,14 @@
 rter
+Pos
  = 
-process.argv%5B
 proc
@@ -239,13 +239,84 @@
 er')
- + 1%5D
+;%0A    var reporter = reporterPos %3E -1 ? process.argv%5BreporterPos + 1%5D : null
 ;%0A%0A 

Fix --reporter detection