-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathgulpfile.js
50 lines (40 loc) · 1.2 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* standard gulp build file for browser client projects
*/
'use strict';
var gulp = require('gulp'),
path = require('path'),
gutil = require('gulp-util'),
del = require('del'),
gulpif = require('gulp-if'),
plumber = require('gulp-plumber'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
jshint = require('gulp-jshint'),
mocha = require('gulp-mocha'),
map = require('map-stream'),
fs = require('vinyl-fs');
var errorHandler = function(err) {
gutil.beep();
console.log( err );
};
var paths = {
src: 'lib/*.js',
tests: 'test/*.js'
};
gulp.task('jshint', function() {
gulp.src([ paths.src, paths.tests ], { read:false } )
.pipe( plumber({ errorHandler:errorHandler }) )
.pipe( jshint() )
.pipe( jshint.reporter('jshint-stylish') );
});
gulp.task('mocha', function() {
gulp.src( paths.tests, { read:false } )
.pipe( plumber({ errorHandler:errorHandler }) )
.pipe( mocha({ reporter:'spec' }) );
});
gulp.task('test', [ 'mocha', 'jshint' ] );
gulp.task('watch', [ 'test' ], function () {
gulp.watch([ paths.src, paths.tests ], [ 'test' ]);
});
gulp.task('default', [ 'test', 'watch' ]);