-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
54 lines (48 loc) · 1.21 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
var gulp = require('gulp'),
eslint = require('gulp-eslint'),
KarmaServer = require('karma').Server,
path = require('path');
(function() {
'use strict';
var paths = {
spec: [
'ecommerce/static/js/**/*.js',
'ecommerce/static/js/test/**/*.js',
'ecommerce/static/templates/**/*.js'
],
lint: [
'build.js',
'gulpfile.js',
'ecommerce/static/js/**/*.js',
'ecommerce/static/js/test/**/*.js'
],
karamaConf: 'karma.conf.js'
};
/**
* Runs the JS unit tests
*/
gulp.task('test', function(cb) {
new KarmaServer({
configFile: path.resolve('karma.conf.js')
}, cb).start();
});
/**
* Runs the ESLint linter.
*
* http://eslint.org/docs/about/
*/
gulp.task('lint', function() {
return gulp.src(paths.lint)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
/**
* Monitors the source and test files, running tests
* and linters when changes detected.
*/
gulp.task('watch', function() {
gulp.watch(paths.spec, ['test', 'lint']);
});
gulp.task('default', gulp.series('test'));
}());