-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
49 lines (43 loc) · 1.12 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
var gulp = require('gulp');
var gutil = require('gulp-util');
var mocha = require('gulp-mocha');
var cover = require('gulp-coverage');
var browserify = require('gulp-browserify');
var uglify = require('gulp-uglify');
var paths = {
src: 'src/**/*.js',
test: 'test/**/*.js'
};
gulp.task('coverage', function () {
gulp.src([paths.test])
.pipe(cover.instrument({
pattern: [paths.src],
debugDirectory: '.debug'
}))
.pipe(mocha({
reporter: 'dot'
}))
.pipe(cover.report({
outFile: 'coverage.html'
}))
.pipe(cover.enforce({}));
gutil.log('View coverage report in coverage.html');
});
gulp.task('test', function () {
gulp.src(paths.test).pipe(mocha());
});
gulp.task('ci', ['test'], function () {
gulp.watch([paths.src, paths.test], ['test']);
});
gulp.task('build', function () {
if (gutil.env.debug) {
gutil.log(gutil.colors.green('Building with sourcemaps'));
}
gulp.src('./formatter.js', {read: false})
.pipe(browserify({
debug: gutil.env.debug
, standalone: 'formatter' // this is the global name
}))
.pipe(uglify())
.pipe(gulp.dest('./build'))
});