forked from nyambati/express-acl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
57 lines (49 loc) · 1.28 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
55
56
57
'use strict';
const gulp = require('gulp');
const plugins = require('gulp-load-plugins')();
const paths = {
tests: ['tests/**/*.spec.js'],
scripts: ['lib/**', 'tests/**', '!tests/config/*.yml']
};
/**
* - Gulp task for linting all js scripts
*/
gulp.task('lint', () =>
gulp
.src(paths.tests)
.pipe(plugins.eslint())
// eslint.format() outputs the lint results to the console.
// Alternatively use eslint.formatEach() (see Docs).
.pipe(plugins.eslint.format())
// To have the process exit with an error code (1) on
// lint error, return the stream and pipe to failAfterError last.
.pipe(plugins.eslint.failAfterError())
);
/**
* Gulp task to run tests
*
*/
gulp.task('pre-test', () =>
gulp
.src(['lib/**/*.js'])
.pipe(plugins.istanbul())
.pipe(plugins.istanbul.hookRequire())
);
gulp.task(
'test',
gulp.series('pre-test', () =>
gulp
.src(paths.tests, { read: false })
.pipe(plugins.mocha())
.pipe(plugins.istanbul.writeReports())
.pipe(plugins.istanbul.enforceThresholds({ thresholds: { global: 90 } }))
)
);
/**
* Watch for changes and lint in all ours scripts and lints
*/
gulp.task('watch', () => gulp.watch(paths.scripts, ['lint']));
/**
* Start gulp
*/
gulp.task('default', gulp.series('lint', 'watch'));