-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGulpfile.js
More file actions
68 lines (54 loc) · 1.29 KB
/
Gulpfile.js
File metadata and controls
68 lines (54 loc) · 1.29 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
'use strict';
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var cover = require('gulp-coverage');
var jshint = require('gulp-jshint');
var runSequence = require('run-sequence');
var clean = require('gulp-clean');
/**
* Test
*/
gulp.task('test', function () {
return gulp.src('./test/*.test.js')
.pipe(mocha({ reporter: 'spec' }));
});
/*
* Coverage
*/
gulp.task('coverage-generate', function () {
return gulp.src('./test/*.test.js')
.pipe(cover.instrument({
pattern: ['./lib/*.js'],
debugDirectory: 'debug'
}))
.pipe(mocha())
.pipe(cover.report({
outFile: 'coverage.html'
}));
});
gulp.task('coverage-clean', ['coverage-generate'], function () {
return gulp.src(['./.coverdata/', './.coverrun', './debug/'])
.pipe(clean());
});
gulp.task('coverage', ['coverage-generate', 'coverage-clean']);
/**
* JSHint
*/
gulp.task('jshint', function () {
gulp.src('./{lib,test}/*.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});
/**
* Super Tasks
*/
gulp.task('default', ['all'], function () {
process.exit();
});
gulp.task('all', ['test', 'jshint'], function (callback) {
//Very important we run coverage afterwards or it crashes
//some unit tests.
runSequence('coverage', function() {
callback();
});
});