-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
37 lines (28 loc) · 1.06 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
const gulp = require("gulp");
function isFixed(file) {
return file.eslint && file.eslint.fixed;
}
gulp.task("eslint", () => {
const path = require("path");
const eslint = require("gulp-eslint");
const gulpIf = require("gulp-if");
return gulp.src(["**/*.js", "!node_modules/**"])
.pipe(eslint({fix: true, ignorePath: path.join(__dirname, ".eslintignore")}))
.pipe(eslint.format())
.pipe(gulpIf(isFixed, gulp.dest("./")))
.pipe(eslint.failAfterError());
});
gulp.task("lint", gulp.parallel(["eslint"]));
gulp.task("test.unit", () => {
const mocha = require("gulp-mocha");
const mochaConfig = require("./mocha.config");
return gulp.src("test/unit/**/*.js", {read: false})
.pipe(mocha(mochaConfig));
});
gulp.task("test.integration", () => {
const mocha = require("gulp-mocha");
const mochaConfig = require("./mocha.config");
return gulp.src("test/integration/**/*.js", {read: false})
.pipe(mocha(mochaConfig));
});
gulp.task("test", gulp.parallel(["test.unit", "test.integration"]));