-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
41 lines (36 loc) · 914 Bytes
/
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
var gulp = require('gulp');
var gutil = require('gulp-util');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var mocha = require('gulp-mocha');
var config = {
jshint: {
src: './index.js'
},
test: {
base: './test/',
pattern: '**/*test.js'
}
};
function runMochaSimply() {
return gulp
.src(config.test.base + config.test.pattern, {read: false})
.pipe(mocha({
ui: 'bdd',
reporter: 'dot'
}))
.on('error', gutil.log);
}
gulp.task('watch', function () {
gulp.watch(['index.js', 'test/**/*.js'], runMochaSimply);
runMochaSimply();
});
gulp.task('lint', function() {
return gulp.src(config.jshint.src)
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});
gulp.task('unit', function () {
return runMochaSimply();
});
gulp.task('test', gulp.task('unit'));