-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
80 lines (64 loc) · 1.76 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
74
75
76
77
78
79
80
const gulp = require("gulp");
const ts = require("gulp-typescript");
const shell = require("gulp-shell");
const mocha = require("gulp-mocha");
const eslint = require("gulp-eslint");
gulp.task("default", () => {
const tsProject = ts.createProject("tsconfig.json");
return gulp.src("src/*.ts")
.pipe(tsProject())
.pipe(gulp.dest("dist/"));
});
gulp.task("transpile-test", () => {
const tsProject = ts.createProject("tsconfig.json");
return gulp.src("test/*.ts")
.pipe(tsProject())
.pipe(gulp.dest("dist/"));
});
gulp.task("test-transpile", () => {
return gulp.src("dist/*.js").pipe(mocha());
});
gulp.task("run-server", () => {
return gulp.src("src/routes.ts").pipe(shell("node dist/routes.js"));
});
gulp.task("build", (done) => {
// No hace nada
done();
});
gulp.task("install", (done) => {
// No hace nada
done();
});
gulp.task("test", (done) => {
/*gulp.src("test/tests.ts").pipe(mocha({
require: ["ts-node/register"]
}));
gulp.src("test/api-tests.ts").pipe(mocha({
require: ["ts-node/register"],
timeout: 10000
}));*/
gulp.src("test/etcd-tests.ts").pipe(mocha({
require: ["ts-node/register"]
}));
done();
});
gulp.task("test-ts:coverage", (done) => {
gulp.src("test/*.ts")
.pipe(shell("nyc mocha --require ts-node/register test/*.ts"));
done();
});
gulp.task("lint", (done) => {
gulp.src("test/*.ts")
.pipe(eslint({
configFile: ".eslintrc"
}))
.pipe(eslint.format());
gulp.src("src/*.ts")
.pipe(eslint({
configFile: ".eslintrc"
}))
.pipe(eslint.format());
done();
});
gulp.task("server", gulp.series("default", "run-server"));
gulp.task("tests", gulp.series("default", "transpile-test", "test"));