forked from yodle/new-relic-synthetics-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
30 lines (24 loc) · 857 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
const gulp = require('gulp');
const jshint = require('gulp-jshint');
const mocha = require('gulp-mocha');
const istanbul = require('gulp-istanbul');
gulp.task('lint', function() {
return gulp.src('./lib/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});
gulp.task('pre-test', () => {
return gulp.src(['./lib/**/*.js'])
.pipe(istanbul())
.pipe(istanbul.hookRequire());
})
gulp.task('test', ['pre-test'], () => {
return gulp.src('./test/**/*.js')
.pipe(mocha({reporter: 'spec' }))
// Ugly hack because the mocha plugin doesn't properly exit with an exit code on test failures
.on('error', (err) => { process.exit(1) })
.pipe(istanbul.writeReports())
.pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } }));
});
gulp.task('default', ['lint', 'test']);