-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
39 lines (32 loc) · 984 Bytes
/
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
"use strict";
var gulp = require("gulp");
var plumber = require("gulp-plumber");
var mocha = require("gulp-mocha");
var istanbul = require("gulp-istanbul");
var coveralls = require("gulp-coveralls");
gulp.task("default", ["coverage"]);
gulp.task("watch", function () {
gulp.watch(["lib/**", "test/**"], ["test"]);
});
gulp.task("test", function () {
return gulp.src("test/**/*.js", { read: false })
.pipe(mocha());
});
gulp.task("pre-coverage", function () {
return gulp.src("lib/**/*.js")
.pipe(istanbul())
.pipe(istanbul.hookRequire());
});
gulp.task("coverage", ["pre-coverage"], function (cb) {
var mochaError;
gulp.src("test/**/*.js", { read: false })
.pipe(plumber())
.pipe(mocha())
.on("error", function (err) { mochaError = err })
.pipe(istanbul.writeReports())
.on("end", function () { cb(mochaError) });
});
gulp.task("test-ci", ["coverage"], function () {
return gulp.src("coverage/lcov.info")
.pipe(coveralls());
});