-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathgulpfile.js
More file actions
35 lines (28 loc) · 860 Bytes
/
gulpfile.js
File metadata and controls
35 lines (28 loc) · 860 Bytes
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
'use strict';
let gulp = require('gulp');
let mocha = require('gulp-mocha');
let eslint = require('gulp-eslint');
let notify = require('gulp-notify');
let plumber = require('gulp-plumber');
let gulputil = require('gulp-util');
gulp.task('lint', () => {
gulp.src('./api/**/*.js')
.pipe(plumber({
errorHandler: gulputil.env.type === 'ci' ? gulputil.noop() : notify.onError("Error: <%= error.message %>")
}))
.pipe(eslint({
useEslintrc: true
}))
.pipe(eslint.format());
});
gulp.task('test', () => {
gulp.src('./tests/**/*.js')
.pipe(plumber({
errorHandler: gulputil.env.type === 'ci' ? gulputil.noop() : notify.onError("Error: <%= error %>")
}))
.pipe(mocha({reporter: 'spec'}));
});
gulp.task('default', ['lint','test'],() => {
gulp.watch('./api/**/*.js', ['lint','test']);
gulp.watch('./tests/**/*.js', ['test']);
});