-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
36 lines (30 loc) · 1 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
'use strict';
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
var _ = require('lodash');
function isCIEnvironment() {
return !_.isUndefined(process.env.CI);
}
gulp.task('lint', function eslint() {
return gulp.src([ 'src/**/*.js', 'test/**/*.js', 'config/**/*.js', 'gulpfile.js', 'server.js' ])
.pipe(plugins.eslint())
.pipe(plugins.eslint.format())
.pipe(plugins.if(isCIEnvironment(), plugins.eslint.failOnError()));
});
gulp.task('test', function mocha() {
return gulp.src([ 'test/**/*.test.js' ])
.pipe(plugins.mocha({
ui: 'bdd',
reporter: 'spec',
globals: {
testHelper: require('./test/helpers/chai'),
sinon: require('./test/helpers/sinon')
},
growl: true
}));
});
gulp.task('watch', function watch() {
gulp.watch([ 'src/**/*.js', 'test/**/*.js' ], [ 'test' ]);
gulp.watch([ 'src/**/*.js', 'test/**/*.js', 'config/**/*.js', 'gulpfile.js', 'server.js' ], [ 'lint' ]);
});
gulp.task('default', [ 'lint', 'test' ]);