-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
36 lines (29 loc) · 946 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
// @ts-nocheck
'use strict'
const gulp = require('gulp')
const istanbul = require('gulp-istanbul')
const jshint = require('gulp-jshint')
const mocha = require('gulp-mocha')
const stylish = require('jshint-stylish')
const packageJSON = require('./package')
const jshintConfig = packageJSON.jshintConfig
gulp.task('lint', function () {
return gulp
.src(['./*.js', 'routes/**/*.js', 'test/**/*.js', 'controller/**/*.js'])
.pipe(jshint(jshintConfig))
.pipe(jshint.reporter(stylish))
})
gulp.task('unittest', function () {
return gulp
.src(['*.js', 'routes/**/*.js'])
.pipe(istanbul()) // Covering files
.pipe(istanbul.hookRequire()) // Force `require` to return covered files
.on('finish', function () {
gulp
.src(['test/*.test.js'])
.pipe(mocha({ reporter: 'nyan' }))
.pipe(istanbul.writeReports())
})
})
gulp.task('test', ['unittest'])
gulp.task('default', ['lint', 'test'])