/
gulpfile.js
57 lines (48 loc) · 1.4 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
'use strict';
var gulp = require('gulp');
// Load plugins
var $ = require('gulp-load-plugins')();
gulp.task('beautify', function() {
return gulp.src('./lib/**/*.js')
.pipe($.jsPrettify({
indent_size: 2,
indent_char: ' ',
indent_level: 0,
indent_with_tabs: false,
preserve_newlines: true,
max_preserve_newlines: 4,
jslint_happy: true,
brace_style: 'collapse',
keep_array_indentation: false,
keep_function_indentation: false,
space_before_conditional: true,
break_chained_methods: false,
eval_code: false,
unescape_strings: false,
wrap_line_length: 0
}))
.pipe(gulp.dest('./lib/'));
});
gulp.task('jshint', ['beautify'], function() {
return gulp.src('./lib/**/*.js')
.pipe($.jshint('.jshintrc'))
.pipe($.jshint.reporter('jshint-stylish'))
.pipe($.jshint.reporter('fail'));
});
gulp.task('istanbul', function() {
return gulp.src('./lib/**/*.js').pipe($.istanbul());
});
gulp.task('mocha', ['istanbul'], function() {
var chai = require('chai');
global.should = chai.should();
return gulp.src(['./test/npm/**/*.js', './test/bower/**/*.js'])
.pipe($.mocha({
reporter: 'spec',
globals: ['should']
}))
.pipe($.istanbul.writeReports());
});
gulp.task('build', ['jshint', 'mocha']);
gulp.task('default', ['build'], function() {
return gulp.src(['gulpfile.js']).pipe($.exit());
});