-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
60 lines (53 loc) · 1.12 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
"use strict";
const gulp = require("gulp");
const istanbul = require("gulp-istanbul");
const eslint = require("gulp-eslint");
const mocha = require("gulp-mocha");
const coveralls = require("gulp-coveralls");
const config = {
coverage : {
file : "coverage/lcov.info",
thresholds : {
each : 100
}
},
paths : {
js : [
"gulpfile.js",
"index.js",
"test/**/*.js"
],
tests : [
"tests/**/*.test.js"
]
}
};
gulp.task("lint", () => {
return gulp
.src(config.paths.js)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task("pre-test", () => {
return gulp
.src(config.paths.js)
.pipe(istanbul())
.pipe(istanbul.hookRequire());
});
gulp.task("mocha", ["pre-test"], () => {
return gulp
.src(config.paths.tests)
.pipe(mocha())
.pipe(istanbul.writeReports())
.pipe(istanbul.enforceThresholds({
thresholds : config.coverage.thresholds
}));
});
gulp.task("coveralls", () => {
return process.env.CI && gulp
.src(config.coverage.file)
.pipe(coveralls());
});
gulp.task("test", ["lint", "mocha"]);
gulp.task("default", ["test", "coveralls"]);