-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
64 lines (57 loc) · 1.43 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
58
59
60
61
62
63
64
'use strict';
var gulp = require('gulp'),
mocha = require('gulp-mocha'),
eslint = require('gulp-eslint'),
istanbul = require('gulp-istanbul'),
codacy = require('gulp-codacy'),
debug = require('gulp-debug'),
coveralls = require('gulp-coveralls');
gulp.task('test', ['eslint'], function() {
return gulp
.src('./test/**/*.js', {
read: false,
})
.pipe(
mocha({
reporter: 'spec',
})
);
});
gulp.task('coverage', ['eslint'], function(done) {
// no return, don't return the stream when callbacking
gulp
.src('./lib/**/*.js')
.pipe(istanbul()) // covering files
.pipe(istanbul.hookRequire())
.on('finish', function() {
gulp
.src('./test/**/*.js')
.pipe(
mocha({
reporter: 'spec',
})
)
.pipe(istanbul.writeReports()) // Creating the reports after tests runned
.on('end', done);
});
});
gulp.task('report-coverage', function() {
return gulp
.src('./coverage/**/lcov.info')
.pipe(debug())
.pipe(coveralls());
});
gulp.task('report-codacy', function() {
return gulp
.src('./coverage/**/lcov.info')
.pipe(debug())
.pipe(codacy());
});
gulp.task('eslint', function() {
return gulp
.src(['./lib/**/*.js', './test/**/*.js', './example/**/*.js', './gulpfile.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failOnError());
});
gulp.task('default', ['test']);