-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
56 lines (50 loc) · 1.15 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
'use strict';
const gulp = require('gulp');
const mocha = require('gulp-mocha');
const istanbul = require('gulp-istanbul');
const argv = require('yargs').argv;
/**
* Istanbul coverage
*/
gulp.task('pre-test', () => {
return gulp.src([
'**/*.js',
'!gulpfile.js',
'!coverage/**',
'!test/**',
'!node_modules/**',
'!public/**',
'!views/**',
'!misc/**',
'!api-doc/**',
'!doc/**'
]).pipe(istanbul())
.pipe(istanbul.hookRequire());
});
/**
* Mocha tests and coverage report
*/
gulp.task('test', ['pre-test'], () => {
const stream = gulp.src(['test/**/*.js'], { read: false })
.pipe(mocha({
ui: 'bdd',
timeout: 5000,
slow: 50,
reporter: 'spec',
recursive: true,
require: ['./test/common']
}));
if (!argv.noReport) stream.pipe(istanbul.writeReports());
return stream.pipe(istanbul.enforceThresholds({ thresholds: { global: 100 } }))
.once('error', err => {
console.error(err); // eslint-disable-line no-console
return process.exit(1);
})
.once('end', () => {
return process.exit(0);
});
});
/**
* Default task
*/
gulp.task('default', ['test']);