-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathgulpfile.js
More file actions
52 lines (48 loc) · 1.59 KB
/
gulpfile.js
File metadata and controls
52 lines (48 loc) · 1.59 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
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var mocha = require('gulp-mocha');
var cover = require('gulp-coverage');
var clean = require('gulp-clean');
var runSequence = require('run-sequence');
gulp.task('lint', function () {
return gulp.src(['**/*.js', '!**/node_modules/**', '!debug/**/*.js'])
.pipe(jshint({lookup: true}))
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});
gulp.task('unit_pre', function () {
return gulp.src(['*/**/*.unit.spec.js', '!**/node_modules/**/*.js'], {read: false})
.pipe(cover.instrument({
pattern: ['*.js', '*/**/*.js', '!*/**/*.spec.js', '!**/node_modules/**/*.js', '!debug/**/*.js', '!gulpfile.js'],
debugDirectory: 'debug'
}))
.pipe(mocha({reporter: 'spec', timeout: '10000'}))
.pipe(cover.gather())
.pipe(cover.format({
reporter: 'html',
outFile: 'coverage-unit.html'
}))
.pipe(gulp.dest('coverage'))
.pipe(cover.enforce({
statements: 100,
blocks: 100,
lines: 100,
uncovered: undefined
}))
.once('error', function (err) {
console.error(err);
process.exit(1);
});
});
gulp.task('clean', function () {
return gulp.src(['.coverdata', 'debug', '.coverrun'], {read: false})
.pipe(clean())
.once('end', function () {
process.exit();
});
});
gulp.task('unit_test', function (callback) {
runSequence(
'unit_pre',
callback);
});