-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.babel.js
57 lines (51 loc) · 1.29 KB
/
gulpfile.babel.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
import gulp from 'gulp';
import gulpNodemon from 'gulp-nodemon';
import jasmineNode from 'gulp-jasmine-node';
import istanbul from 'gulp-babel-istanbul';
import gulpCoveralls from 'gulp-coveralls';
import babel from 'gulp-babel';
import injectModules from 'gulp-inject-modules';
import exit from 'gulp-exit';
const jasmineNodeOpts = {
timeout: 500000,
includeStackTrace: true,
color: true
};
gulp.task('build', () => {
gulp.src('server/**/*.js')
.pipe(babel())
.pipe(gulp.dest('build'));
});
gulp.task('serve', () => {
gulpNodemon({
script: './app.js',
ext: 'js html'
});
});
gulp.task('test', () => {
gulp.src('./server/tests/**/*.js')
.pipe(babel())
.pipe(jasmineNode(jasmineNodeOpts));
});
gulp.task('coverage', (cb) => {
gulp.src('build/**/*.js')
.pipe(istanbul())
.pipe(istanbul.hookRequire())
.on('finish', () => {
gulp.src(['./server/tests/**/*.js'])
.pipe(babel())
.pipe(injectModules())
.pipe(jasmineNode())
.pipe(istanbul.writeReports())
.pipe(istanbul.enforceThresholds({ thresholds: { global: 30 } }))
.on('end', cb)
.pipe(exit());
});
});
gulp.task('coveralls', ['coverage'], () => {
if (!process.env.CI) {
return;
}
return gulp.src('/lcov.info')
.pipe(gulpCoveralls());
});