-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
73 lines (60 loc) · 1.47 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
61
62
63
64
65
66
67
68
69
70
71
72
73
let gulp = require("gulp");
let reporters = require("jasmine-reporters");
let del = require("del");
let plugins = require("gulp-load-plugins")({
rename: {
"gulp-eslint": "eslint",
"gulp-jasmine": "jasmine",
"gulp-istanbul": "istanbul",
"gulp-strip-code": "stripCode"
}
});
let sources = ["./bin/gitlint", "./bin/**/*.js", "./lib/**/*.js"];
let tests = ["./tests/**/*Spec.js"];
let misc = ["./gulpfile.js", "./.eslintrc.js"];
let all = sources.slice().concat(tests).concat(misc);
gulp.task("default", ["lint", "tests"]);
gulp.task("lint:js", () => {
return gulp.src(all)
.pipe(plugins.eslint())
.pipe(plugins.eslint.format("unix"))
.pipe(plugins.eslint.failAfterError());
});
gulp.task("lint", ["lint:js"]);
// Tests
gulp.task("test:setup", () => {
return gulp.src(sources)
.pipe(plugins.istanbul())
.pipe(plugins.istanbul.hookRequire());
});
gulp.task("tests", ["test:setup"], () => {
return gulp.src(tests)
.pipe(plugins.jasmine({
reporter: new reporters.TerminalReporter()
}))
.pipe(plugins.istanbul.writeReports());
// .pipe(plugins.istanbul.enforceThresholds({thresholds: {global: 90}}));
});
gulp.task("test-without-coverage", () => {
return gulp.src(tests)
.pipe(plugins.jasmine());
});
//
// Deploy
//
gulp.task("build", function() {
gulp.src(sources)
.pipe(plugins.stripCode({
start_comment: "start-test",
end_comment: "end-test"
}))
.pipe(gulp.dest("build"));
});
//
// Clean
//
gulp.task("clean", (cb) => {
del([
"build"
], cb);
});