-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
41 lines (34 loc) · 1019 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
'use strict';
//gulp and plugins
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
stylish = require('jshint-stylish'),
jscs = require('gulp-jscs'),
KarmaServer = require('karma').Server;
var jsSrc = ['src/**/*.js',
'test/**/*-test.js'
];
gulp.task('lint', function() {
return gulp.src(jsSrc)
.pipe(jshint())
.pipe(jshint.reporter(stylish))
.on('error', function(error) {
console.log(error);
});
});
gulp.task('style-check', function() {
return gulp.src(jsSrc)
.pipe(jscs())
.pipe(jscs.reporter());
});
//https://stackoverflow.com/questions/26614738/issue-running-karma-task-from-gulp
gulp.task('test', function (done) {
new KarmaServer({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, function() { done(); }).start();
});
gulp.task('watch', function() {
gulp.watch(jsSrc, ['default']);
});
gulp.task('default', ['lint', 'style-check', 'test']);