-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgulpfile.js
43 lines (37 loc) · 972 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
42
43
'use strict';
const {src, series} = require('gulp');
const path = require('path');
const eslint = require('gulp-eslint');
const excludeGitignore = require('gulp-exclude-gitignore');
const mocha = require('gulp-mocha');
const istanbul = require('gulp-istanbul');
const plumber = require('gulp-plumber');
function runStatic() {
return src('**/*.js')
.pipe(excludeGitignore())
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
}
function runPreTest() {
return src('generators\**\*.js')
.pipe(istanbul({
includeUntested: true
}))
.pipe(istanbul.hookRequire());
}
function runTest() {
let mochaErr;
src('test/**/*.js')
.pipe(plumber())
.pipe(mocha({reporter: 'spec'}))
.on('error', function (err) {
mochaErr = err;
})
.pipe(istanbul.writeReports())
.on('end', function () {
cb(mochaErr);
});
}
const test = series(runStatic, runPreTest, runTest);
exports.test = test;