forked from hipache/hipache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
85 lines (67 loc) · 2.44 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
(function () {
'use strict';
var gulp = require('gulp');
// var gutil = require('gulp-util');
var mocha = require('gulp-mocha');
// var eslint = require('gulp-eslint');
var jshint = require('gulp-jshint');
var jsreporter = require('jshint-stylish');
var driverstests = ['./test/unit/driver-*'];
var unittests = ['./test/unit/*.js', '!./test/unit/driver-*'];
var functests = ['./test/functional/*.js'];
var alltests = ['./test/**/*.js'];
var scripts = ['*.js', './bin/*', './lib/**/*.js', './test/**/*.js'];
gulp.task('hint', function () {
return gulp.src(scripts)
// eslint(esconfig),
// eslint.formatEach(esreporter),
.pipe(jshint())
.pipe(jshint.reporter(jsreporter))
.pipe(jshint.reporter('fail'));
});
gulp.task('test:unit', function () {
return gulp.src(unittests)
.pipe(mocha({ reporter: 'spec' }));
});
// These also tests expiring / timeouts, hence are long - to be run manually only
gulp.task('test:drivers', function () {
return gulp.src(driverstests)
.pipe(mocha({ reporter: 'spec' }));
});
gulp.task('hint-catched', function () {
return gulp.src(scripts)
// eslint(esconfig),
// eslint.formatEach(esreporter),
.pipe(jshint())
.pipe(jshint.reporter(jsreporter));
});
gulp.task('test:unit-catched', ['hint-catched'], function () {
return gulp.src(unittests)
.pipe(mocha({ reporter: 'spec' }).on("error", function (/*err*/) {
this.emit('end');
})
);
});
gulp.task('test:drivers-catched', ['test:unit-catched'], function () {
return gulp.src(driverstests)
.pipe(mocha({ reporter: 'spec' }).on("error", function (/*err*/) {
this.emit('end');
})
);
});
gulp.task('test:func', function () {
return gulp.src(functests)
.pipe(mocha({ reporter: 'spec' }));
});
gulp.task('test:all', function () {
return gulp.src(alltests)
.pipe(mocha({ reporter: 'spec' }));
});
// var esconfig = JSON.parse(fs.readFileSync('./.eslintrc'));
gulp.task('hack:hipache', function () {
gulp.watch(scripts, ['test:unit-catched']);
});
gulp.task('hack:drivers', function () {
gulp.watch(scripts, ['test:drivers-catched']);
});
}());