-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
47 lines (40 loc) · 1.04 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
const gulp = require('gulp')
const eslint = require('gulp-eslint')
const mocha = require('gulp-mocha')
const running = {}
const watching = {}
const files = {
gulp: 'gulpfile.js',
src: 'lib/**/*.js',
unit: 'test/unit/**/*.js',
integration: 'test/integration/**/*.js'
}
files.all = Object.keys(files).map(k => files[k])
gulp.task('lint', () => {
running.lint = files.all
return gulp.src(running.lint)
.pipe(eslint())
.pipe(eslint.format())
})
gulp.task('unit', () => {
process.env.LOG_LEVEL = 'none'
running.unit = [files.src, files.unit]
return gulp.src(files.unit)
.pipe(mocha({reporter: 'spec'}))
})
gulp.task('integration', () => {
process.env.LOG_LEVEL = 'none'
running.integration = [files.src, files.integration]
return gulp.src(files.integration)
.pipe(mocha({reporter: 'spec'}))
})
gulp.task('test', ['unit', 'integration'])
gulp.task('watch', () => {
Object
.keys(running)
.filter(key => !watching[key])
.forEach(key => {
watching[key] = true
gulp.watch(running[key], [key])
})
})