-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
63 lines (56 loc) · 1.45 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
58
59
60
61
62
63
import gulp from 'gulp';
import nodemon from 'gulp-nodemon';
import babel from 'gulp-babel';
import jasmineNode from 'gulp-jasmine-node';
import istanbul from 'gulp-istanbul';
import injectModules from 'gulp-inject-modules';
import exit from 'gulp-exit';
import coveralls from 'gulp-coveralls';
import yaml from 'gulp-yaml';
gulp.task('nodemon', () => {
nodemon({
script: 'build/server.js',
ext: 'js',
ignore: ['README.md', 'node_modules/**', '.DS_Store'],
watch: ['server']
});
});
gulp.task('dev', () => {
return gulp.src('server/**/*.js')
.pipe(babel({
presets: ['es2015', 'stage-2']
}))
.pipe(gulp.dest('build'));
});
gulp.task('default', ['dev', 'nodemon'], () => {
gulp.watch('server/**/*.js', ['dev']);
});
const jasmineNodeOpts = {
timeout: 100000,
includeStackTrace: false,
color: true
};
gulp.task('api-tests', () => {
gulp.src('./test/**/*.js')
.pipe(babel())
.pipe(jasmineNode(jasmineNodeOpts));
});
gulp.task('coverage', (cb) => {
gulp.src('build/**/*.js')
.pipe(istanbul())
.pipe(istanbul.hookRequire())
.on('finish', () => {
gulp.src('test/server/*.js')
.pipe(babel())
.pipe(injectModules())
.pipe(jasmineNode())
.pipe(istanbul.writeReports())
.pipe(istanbul.enforceThresholds({ thresholds: { global: 30 } }))
.on('end', cb)
.pipe(exit());
});
});
gulp.task('coveralls', () => {
return gulp.src('./coverage/lcov')
.pipe(coveralls());
});