forked from openedx/ecommerce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
62 lines (56 loc) · 1.35 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
'use strict';
var gulp = require('gulp'),
jscs = require('gulp-jscs'),
jshint = require('gulp-jshint'),
KarmaServer = require('karma').Server,
path = require('path'),
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 JSHint linter.
*
* http://jshint.com/about/
*/
gulp.task('lint', function () {
return gulp.src(paths.lint)
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});
/**
* Runs the JavaScript Code Style (JSCS) linter.
*
* http://jscs.info/
*/
gulp.task('jscs', function () {
return gulp.src(paths.lint)
.pipe(jscs());
});
/**
* Monitors the source and test files, running tests
* and linters when changes detected.
*/
gulp.task('watch', function () {
gulp.watch(paths.spec, ['test', 'lint', 'jscs']);
});
gulp.task('default', ['test']);