-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgulpfile.js
44 lines (37 loc) · 1.37 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
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var eslintIfFixed = require('gulp-eslint-if-fixed');
var clean = require('gulp-clean');
var jasmineNode = require('gulp-jasmine-node');
var jasmine = require('jasmine-node');
var spawnSync = require('child_process').spawnSync;
gulp.task('clean', function() {
return gulp.src(['coverage'], { read: false })
.pipe(clean({ force: true }));
});
gulp.task('jslint', function() {
var fix = (process.argv.slice(2).indexOf('--fix') >= 0);
return gulp
.src(['**/*.js', '!node_modules/**', '!bower_components/**', '!coverage/**', '!docs/**'])
.pipe(eslint({
fix: fix,
}))
.pipe(eslint.formatEach('stylish', process.stderr))
.pipe(eslint.failAfterError())
.pipe(eslintIfFixed('.'));
});
gulp.task('test', ['clean'], function() {
return gulp.src(['test/**/*.js']).pipe(jasmineNode({
timeout: 10000,
reporter: [
new jasmine.TerminalVerboseReporter({ color: true, includeStackTrace: true })
]
}));
});
gulp.task('test:watch', ['clean', 'test'], function() {
return gulp.watch(['lib/**/*.js', 'test/**/*.js'], function() {
spawnSync('node_modules/gulp/bin/gulp.js', ['test'], { stdio: 'inherit' });
});
});
gulp.task('lint', ['jslint'], function() {});
gulp.task('default', ['lint', 'test'], function() {});