-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
61 lines (53 loc) · 1.63 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
48
49
50
51
52
53
54
55
56
57
58
59
60
const gulp = require('gulp');
const isparta = require('isparta');
// const babel = require('babel/register');
const plugins = require('gulp-load-plugins')();
function unitTests() {
return gulp.src(['tests/config/setup.js', 'tests/unit/**/*.js'])
.pipe(
plugins.mocha(
{
reporter: 'spec',
//compilers: { js: babel },
}
)
);
}
gulp.task(
'lint', () => {
// TODO: This is broken due to gulp-eslint not supporting enum strings
// return gulp.src(['src/**/*.js', 'tests/**/*.js'])
// .pipe(plugins.eslint())
// .pipe(plugins.eslint.format())
// .pipe(plugins.eslint.failAfterError());
}
);
gulp.task(
'coverage', (done) => {
gulp.src(['src/**/*.js'])
.pipe(
plugins.istanbul(
{
instrumenter: isparta.Instrumenter,
includeUntested: true,
}
)
)
.pipe(plugins.istanbul.hookRequire())
.on(
'finish', () => {
unitTests()
.pipe(plugins.istanbul.writeReports())
.pipe(plugins.istanbul.enforceThresholds({ thresholds: { global: 90 } }))
.on('end', done);
}
);
}
);
gulp.task(
'test:unit', () => {
return unitTests();
}
);
gulp.task('test', plugins.sequence('coverage', 'test:unit'));
gulp.task('default', plugins.sequence('lint', 'test'));