-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
42 lines (37 loc) · 1.09 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
var gulp = require('gulp');
var rollup = require('rollup-stream');
var babel = require('gulp-babel');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var Mocha = require('mocha');
var path = require('path');
gulp.task('default', function() {
return rollup({ entry: './src/whether-manager.js' })
.pipe(source('whether-manager.js', './src'))
.pipe(buffer())
.pipe(babel({ presets: ['es2015-minimal'] }))
.pipe(gulp.dest('.'));
});
gulp.task('test', ['default'], function(cb) {
var mocha = new Mocha();
mocha.addFile(path.resolve(process.cwd(), 'test/test.js'));
mocha.run(function(errorCount) {
if(errorCount > 0) {
process.exit(1);
}
cb();
});
});
gulp.task('instrumented', function() {
return rollup({
entry: './src/whether-manager.js',
plugins: [require('rollup-plugin-istanbul')()]
})
.pipe(source('whether-manager.js', './src'))
.pipe(buffer())
.pipe(babel({ presets: ['es2015-minimal'] }))
.pipe(gulp.dest('.'));
});
gulp.task('coverage', ['instrumented'], function(cb) {
require('./scripts/coverage.js')(cb);
});