-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
87 lines (73 loc) · 1.89 KB
/
gulpfile.js
File metadata and controls
87 lines (73 loc) · 1.89 KB
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
81
82
83
84
85
86
87
'use strict';
var gulp = require('gulp'),
gutil = require('gulp-util'),
mocha = require('gulp-mocha'),
istanbul = require('gulp-istanbul');
var TESTS = './test/**/*.js';
var SRC = './lib/**/*.js';
gulp.task('clean', function() {
var del = require('del');
return del(['./coverage/']);
});
gulp.task('lint', function() {
var eslint = require('gulp-eslint');
var t = gulp.src([
SRC,
TESTS,
'gulpfile.js'
])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
return t;
});
gulp.task('test', ['lint'], function() {
var mocha = require('gulp-mocha');
return gulp.src([TESTS])
.pipe(mocha());
});
gulp.task('doc', function() {
var jsdoc = require('gulp-jsdoc');
gulp.src([SRC])
.pipe(jsdoc('./doc'))
});
gulp.task('doc-deploy', ['doc'], function() {
var ghPages = require('gulp-gh-pages');
return gulp.src('./doc/**/*')
.pipe(ghPages());
});
gulp.task('pre-coverage', function() {
return gulp.src([SRC])
.pipe(istanbul())
.pipe(istanbul.hookRequire());
});
gulp.task('coverage', [ 'pre-coverage' ], function() {
var t = gulp.src([TESTS])
.pipe(mocha().on('error', function(er) {
gutil.log(er);
t.end();
}))
.pipe(istanbul.writeReports({
dir: './coverage'
}));
return t;
});
gulp.task('ci', ['coverage'], function() {
var coveralls = require('gulp-coveralls');
gulp.src('./coverage/**/lcov.info')
.pipe(coveralls());
});
gulp.task('watch', ['coverage'], function() {
return gulp.watch([SRC, TESTS], ['coverage']);
});
gulp.task('serve', ['watch'], function() {
var gls = require('gulp-live-server');
var open = require('open');
var server = gls['static']('coverage/lcov-report');
server.start();
open('http://localhost:3000/');
return gulp.watch(['coverage/lcov-report/**/*.html'], function(file) {
return server.notify.apply(server, [file]);
});
});
gulp.task('default', ['coverage']);