-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
49 lines (42 loc) · 1.2 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
'use strict';
var gulp = require('gulp');
var apidoc = require('gulp-apidocjs');
var nodemon = require('gulp-nodemon');
var mocha = require('gulp-mocha');
// code coverage tool
var istanbul = require('gulp-istanbul');
gulp.task('doc', function(cb) {
apidoc.exec({ src: "lib/", dest: "docs/" }, cb);
});
// run index.js, monitor js files for changes and restart server if necessary.
gulp.task('start', function(){
nodemon({ script: 'index.js', ext: 'js'});
});
// start server using local version of dynamo db.
gulp.task('start-test', function() {
nodemon({ script: 'index.js', ext: 'js', env: { 'NODE_ENV': 'test'}})
});
gulp.task('test-coverage', function() {
process.env.NODE_ENV = "test";
return gulp.src('lib/dictionary.js')
.pipe(istanbul())
.pipe(istanbul.hookRequire());
});
gulp.task('test', ['test-coverage'], function() {
process.env.NODE_ENV = "test";
return gulp.src('lib/**/*.spec.js')
.pipe(mocha())
.pipe(istanbul.writeReports(
{
dir: './coverage',
reporters: ['html','lcov']
}
))
.on('error', function(error) {
console.log(error);
})
.on('end', function() {
process.exit();
});
});
gulp.task('default', ['start']);