forked from nyambati/express-acl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
54 lines (47 loc) · 1.26 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
'use strict';
const gulp = require('gulp');
const plugins = require('gulp-load-plugins')();
const paths = {
tests: ['tests/**/**.js'],
scripts: ['lib/**', 'tests/**', '!tests/config/**.yml']
};
/**
* - Gulp task for linting all js scripts
*/
gulp.task('lint', function() {
return gulp.src(paths.scripts)
.pipe(plugins.jshint())
.pipe(plugins.jshint.reporter('jshint-stylish', { verbose: true }));
});
/**
* Gulp task to run tests
*
*/
gulp.task('test', ['pre-test'], function() {
return gulp.src(paths.tests, { read: false })
// The reporter can be changed to preferable one
.pipe(plugins.mocha())
// Creating the reports after tests ran
.pipe(plugins.istanbul.writeReports())
// Enforce a coverage of at least 90%
.pipe(plugins.istanbul.enforceThresholds({
thresholds: { global: 90 }
}));
});
/**
* Watch for changes and lint in all ours scripts and lints
*/
gulp.task('watch', function() {
gulp.watch(paths.scripts, ['lint']);
});
gulp.task('pre-test', function() {
return gulp.src(['lib/**/*.js', 'index.js'])
// Covering files
.pipe(plugins.istanbul())
// Force `require` to return covered files
.pipe(plugins.istanbul.hookRequire());
});
/**
* Start gulp
*/
gulp.task('default', ['lint', 'watch']);