-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
41 lines (32 loc) · 987 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
38
39
40
41
/* eslint no-console: 0 */
'use strict';
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var istanbul = require('gulp-istanbul');
var mocha = require('gulp-mocha');
var codePath = 'lib/**/*.js';
var testPath = 'tests/**/*.js';
var lintCodePaths = [codePath, testPath, 'gulpfile.js'];
function getMochaStream() {
return gulp
.src(testPath)
.pipe(mocha({ reporter: 'spec' }));
}
gulp.task('coverage:prepare', function() {
return gulp.src(codePath)
.pipe(istanbul())
.pipe(istanbul.hookRequire());
});
gulp.task('coverage', ['coverage:prepare'], function() {
return getMochaStream().pipe(istanbul.writeReports());
});
gulp.task('mocha', getMochaStream);
gulp.task('test', ['lint', 'coverage']);
// Lint project and test files
gulp.task('lint', function() {
return gulp.src(lintCodePaths)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failOnError());
});
gulp.task('default', ['test']);