-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
46 lines (40 loc) · 1.03 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
const gulp = require('gulp');
const eslint = require('gulp-eslint');
const shell = require('gulp-shell');
const nodemon = require('gulp-nodemon');
const path = require('path');
const jest = require('jest-cli');
const jestConfig = {
verbose: false,
rootDir: '.'
};
gulp.task('lint', () => {
return gulp.src(['**/*.js', '!node_modules/**'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('jest', (done) => {
jest.runCLI({
config: Object.assign(jestConfig, { testMatch: ['**/test/specs/*.js'] })
}, '.', () => done());
});
gulp.task('watch', ['js'], () =>
nodemon({
script: 'server/start-server-web.js',
ext: 'js',
watch: ['server', 'test'],
ignore: [
'node_modules/'
],
tasks: (changedFiles) => {
let tasks = [];
changedFiles.forEach(file => {
if (path.extname(file) === '.js' && !tasks.includes('js')) tasks.push('js');
});
return tasks;
}
})
);
gulp.task('js', ['lint', 'jest']);
gulp.task('default', ['js']);