-
Notifications
You must be signed in to change notification settings - Fork 22
/
gulpfile.js
37 lines (30 loc) · 988 Bytes
/
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
/* jshint node:true */
'use strict';
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');
var codecov = require('gulp-codecov.io');
gulp.task('lint', function () {
return gulp.src(['index.js', 'tests/test.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'))
});
gulp.task('coverage-setup', function () {
return gulp.src('index.js')
.pipe(istanbul())
.pipe(istanbul.hookRequire());
});
gulp.task('test', ['coverage-setup'], function () {
return gulp.src('tests/test.js', { read: false })
.pipe(mocha({ reporter: 'spec', timeout: 15000 }))
.pipe(istanbul.writeReports());
});
gulp.task('post-coverage', ['test'], function () {
return gulp.src('./coverage/lcov.info')
.pipe(codecov());
});
gulp.task('watch-test', function () {
gulp.watch(['index.js', 'tests/test.js'], ['test']);
});
gulp.task('default', ['lint']);