-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
36 lines (30 loc) · 897 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
'use strict';
var gulp = require('gulp');
var jsonlint = require('gulp-jsonlint');
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');
var plumber = require('gulp-plumber');
gulp.task('set-test-env', function(cb) {
process.env.NODE_ENV = 'test';
cb();
});
gulp.task('lint-json', ['set-test-env'], function(cb) {
gulp.src(['**/*.json', '!./node_modules/**/*.json'])
.pipe(jsonlint())
.pipe(jsonlint.reporter());
cb();
});
gulp.task('test', ['set-test-env'], function(cb) {
var mochaErr;
gulp.src('test/**/*.js')
.pipe(plumber())
.pipe(mocha({reporter: 'spec'}))
.on('error', function(err) {
mochaErr = err;
})
.pipe(istanbul.writeReports())
.on('end', function() {
cb(mochaErr);
});
});
gulp.task('default', ['set-test-env', 'lint-json', 'test']);