forked from FirebaseExtended/firebase-queue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
65 lines (56 loc) · 1.27 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
/**************/
/* REQUIRES */
/**************/
var gulp = require('gulp');
// File I/O
var exit = require('gulp-exit');
var jshint = require('gulp-jshint');
// Testing
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');
/****************/
/* FILE PATHS */
/****************/
var paths = {
js: {
srcFiles: [
'src/**/*.js'
],
destDir: 'dist'
},
tests: [
'test/queue.spec.js',
'test/lib/queue_worker.spec.js'
]
};
/***********/
/* TASKS */
/***********/
// Lints the JavaScript files and copies them to the destination directory
gulp.task('build', function() {
return gulp.src(paths.js.srcFiles)
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'))
.on('error', function(error) {
throw error;
})
.pipe(gulp.dest(paths.js.destDir));
});
// Runs the Mocha test suite
gulp.task('test', function() {
return gulp.src(paths.js.srcFiles)
.pipe(istanbul())
.pipe(istanbul.hookRequire())
.on('finish', function () {
gulp.src(paths.tests)
.pipe(mocha({
reporter: 'spec',
timeout: 2000
}))
.pipe(istanbul.writeReports())
.pipe(exit());
});
});
// Default task
gulp.task('default', ['build', 'test']);