-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
42 lines (36 loc) · 1.37 KB
/
gulpfile.js
File metadata and controls
42 lines (36 loc) · 1.37 KB
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
// include gulp
var gulp = require('gulp');
var istanbul = require('gulp-istanbul');
// We'll use mocha in this example, but any test framework will work
var mocha = require('gulp-mocha');
var coffee = require('gulp-coffee');
gulp.task('pre-test', function () {
return gulp.src(['src/**/*.js'])
// Covering files
.pipe(istanbul())
// Force `require` to return covered files
.pipe(istanbul.hookRequire());
});
gulp.task('test', ['pre-test'], function () {
return gulp.src('src/test/*.js', {read: false})
// gulp-mocha needs filepaths so you can't have any plugins before it {reporter: 'nyan'}
.pipe(mocha())
.pipe(istanbul.writeReports());
// Enforce a coverage of at least 90%
// .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } }));
});
gulp.task('coffee', function() {
gulp.src('./src/*.coffee')
.pipe(coffee({bare: true}).on('error', function(err) {
console.error(err);
}))
.pipe(gulp.dest('./dist/'));
});
gulp.task('coffee-test', function () {
return gulp.src('src/test/*.coffee', {read: false})
// gulp-mocha needs filepaths so you can't have any plugins before it {reporter: 'nyan'}
.pipe(mocha())
.pipe(istanbul.writeReports());
// Enforce a coverage of at least 90%
// .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } }));
});