-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
62 lines (52 loc) · 1.22 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
50
51
52
53
54
55
56
57
58
59
60
61
62
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var prettify = require('gulp-jsbeautifier');
var eslint = require('gulp-eslint');
var jsFiles = ['*.js', 'lib/**/*.js', 'tests/**/*.test.js'];
gulp.task('mocha-ci', function () {
return gulp.src(jsFiles[2], {
read: false
})
.pipe(mocha({
reporter: 'min'
}));
});
gulp.task('beautify', function () {
gulp.src(jsFiles, {
base: '.'
})
.pipe(prettify({
config: '.jsbeautifyrc',
mode: 'VERIFY_AND_WRITE'
}))
.pipe(gulp.dest('.'));
});
gulp.task('beautify:build', function () {
gulp.src(jsFiles)
.pipe(prettify({
config: '.jsbeautifyrc',
mode: 'VERIFY_ONLY'
}));
});
/**
* JavaScript Linting Task
*/
gulp.task('lint', function () {
return gulp.src(jsFiles)
.pipe(eslint())
.pipe(eslint.format());
});
/**
* JavaScript Build Lint Task
*/
gulp.task('lint:build', function () {
return gulp.src(jsFiles)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failOnError());
});
gulp.task('mocha-watch', function () {
gulp.watch(jsFiles, ['mocha-ci']);
});
gulp.task('default', ['beautify', 'mocha-watch']);
gulp.task('test', ['beautify:build', 'lint:build', 'mocha-ci']);