-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31b8cd2
commit 5b98d2d
Showing
3 changed files
with
78 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,33 @@ | ||
var gulp = require('gulp'); | ||
|
||
|
||
var sources = ['*.js', 'src/**/*.js', '!gulpfile.js']; | ||
var testSources = ['test/*.test.js']; | ||
var allSources = sources.concat(testSources); | ||
|
||
gulp.task('default', ['test', 'watch-mocha']); | ||
|
||
gulp.task('test', ['cover', 'mocha']); | ||
gulp.task('default', ['cover', 'watch']); | ||
|
||
gulp.task('mocha', function() { | ||
var mocha = require('gulp-mocha'); | ||
var gutil = require('gulp-util'); | ||
|
||
return gulp.src(testSources, { read: false }) | ||
.pipe( mocha( { | ||
reporter: 'spec', growl: 'true' | ||
} )) | ||
.on('error', gutil.log); | ||
gulp.task('watch', function() { | ||
gulp.watch(allSources, ['cover']); | ||
}); | ||
|
||
gulp.task('watch-mocha', function() { | ||
gulp.watch(allSources, ['cover', 'mocha']); | ||
}); | ||
|
||
// Run tests and output reports | ||
gulp.task('cover', function (cb) { | ||
gulp.task('cover', function () { | ||
var mocha = require('gulp-mocha'); | ||
var gutil = require('gulp-util'); | ||
var istanbul = require('gulp-istanbul'); | ||
|
||
gulp.src(sources) | ||
.pipe(istanbul()) // Covering files | ||
return gulp.src(sources) | ||
// Covering files | ||
.pipe( istanbul() ) | ||
.on('finish', function () { | ||
gulp.src(testSources) | ||
.pipe(mocha()) | ||
.pipe( mocha({ reporter: 'spec', growl: 'true' }) ) | ||
.on('error', gutil.log) // prevent error to stop watch | ||
|
||
.pipe(istanbul.writeReports()) // Creating the reports after tests runned | ||
.on('end', cb); | ||
; | ||
}); | ||
}); | ||
|
||
gulp.task('start_cover', function (cb) { | ||
var istanbul = require('gulp-istanbul'); | ||
|
||
gulp.src(sources) | ||
.pipe(istanbul()) | ||
.on('end', cb); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.