forked from botwillacceptanything/botwillacceptanything
-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
73 lines (61 loc) · 1.82 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
#! /usr/bin/env node
(function () {
'use strict';
var define = require('amdefine')(module);
var deps = [
'./config.js',
'gulp',
'gulp-jsdoc',
'gulp-jshint',
'gulp-mocha',
'gulp-istanbul',
'gulp-foreach',
];
define(deps, function(config, gulp, jsdoc, jshint, mocha, istanbul, foreach) {
var src = [
'lib/*.js'
];
gulp.task('lint', [], function () {
return gulp.src(src)
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('jsdoc', [], function () {
return gulp.src(src)
.pipe(jsdoc.parser())
.pipe(jsdoc.generator('data/doc/'));
});
gulp.task('mocha', [], function (cb) {
var ciMode = (process.env.CI === 'true');
process.env.BUILD_ENVIRONMENT = 'test';
gulp.src(['./*.js', './lib/**/*.js', './test/mocks/**/*.js'])
.pipe(istanbul({
includeUntested: true,
reporters: [ 'lcov' ],
}))
.pipe(istanbul.hookRequire())
.on('finish', function () {
return gulp.src('tests/unit/**/*.js', { read: false })
.pipe(mocha({
reporter: ((!ciMode && config.test_reporter) || 'spec'),
}))
.pipe(istanbul.writeReports())
.on('end', cb);
});
});
// Build Task
gulp.task('build', [
'lint',
'jsdoc',
'test'
]);
// Build Task
gulp.task('test', [
'mocha'
]);
// Default Task
gulp.task('default', [
'build'
]);
});
}());