forked from bitjson/gulp-l10n
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
57 lines (49 loc) · 1.3 KB
/
gulpfile.js
File metadata and controls
57 lines (49 loc) · 1.3 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
'use strict';
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var run = require('run-sequence');
var bin = 'bin/*';
var js = '*.js';
var lib = 'lib/**/*.js';
var tests = 'test/**/*.{js, json}';
var developing = false;
gulp.task('default', ['watch']);
gulp.task('watch', function(){
developing = true;
run('test');
gulp.watch([bin, js, lib, tests], ['test']);
});
gulp.task('test', ['jshint', 'rm-coverage'], function(){
run('cover-tests', 'enforce-coverage');
});
gulp.task('cover-tests', $.shell.task([
'./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --print detail'
]));
gulp.task('jshint', function () {
return gulp.src([bin, js, lib, tests])
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish'))
.pipe($.if(!developing, $.jshint.reporter('fail')));
});
gulp.task('enforce-coverage', function () {
var options = {
thresholds : {
statements : 100,
branches : 100,
lines : 100,
functions : 100
},
coverageDirectory : 'coverage',
rootDirectory : ''
};
return gulp.src('.')
.pipe($.istanbulEnforcer(options));
});
gulp.task('rm-coverage', function (cb) {
require('del')('coverage', function(err){
if(err){
console.error(err);
}
cb();
});
});