forked from xircleag/loopback-audit-logger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
47 lines (39 loc) · 1.1 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
'use strict';
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');
var runSequence = require('run-sequence');
// js linting
gulp.task('jsLint', function () {
return gulp.src(['index.js','lib/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});
// mocha test runner
gulp.task('mochaTest', function (cb) {
gulp.src(['index.js','lib/**/*.js'])
.pipe(istanbul()) // Covering files
.pipe(istanbul.hookRequire()) // Force `require` to return covered files
.on('finish', function () {
gulp.src(['test/index-test.js','test/lib/**/*-test.js'])
.pipe(mocha({ timeout: 10000 }))
.pipe(istanbul.writeReports())// Creating the reports after tests runned
.on('end', function(){
cb();
});
});
});
// default task
gulp.task('default', function (callback) {
runSequence(
'jsLint',
'mochaTest',
function (error) {
if (error) {
console.log(error.message);
}
callback(error);
});
});
gulp.task('build', ['default']);