Last active
August 29, 2015 14:05
-
-
Save diffused/1bd32ae3c48294052828 to your computer and use it in GitHub Desktop.
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
var gulp = require('gulp'); | |
var $ = require('gulp-load-plugins')(); | |
gulp.task('default', ['watchJs', 'watchTests']); | |
// make sure you do not start a path with ./ | |
// there's some bug in gaze that causes globs with ./ to not fire | |
var unitTestPaths = [ | |
'tests/**/*_tests.js' | |
]; | |
var jsPaths = [ | |
'build/app/js/**/*.js' | |
]; | |
function mochaPipe() { | |
return $.mocha({ reporter: 'spec' }); | |
} | |
gulp.task('watchJs', function() { | |
$.watch({ | |
glob: jsPaths, | |
read: false | |
}, | |
function() { | |
gulp.start('allUnitTests'); | |
} | |
); | |
}); | |
// | |
gulp.task('watchTests', function() { | |
$.watch({ | |
glob: unitTestPaths | |
}, | |
function(files) { | |
return files | |
.pipe(mochaPipe()) | |
; | |
}); | |
}); | |
gulp.task('allUnitTests', function() { | |
return gulp.src(unitTestPaths, {read: false}) | |
.pipe(mochaPipe()) | |
; | |
}); |
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
{ | |
"name": "gulp-mocha-watch", | |
"version": "0.2.0", | |
"dependencies": {}, | |
"devDependencies": { | |
"chai": "^1.9.1", | |
"gulp": "^3.8.7", | |
"gulp-load-plugins": "^0.5.3", | |
"gulp-mocha": "^1.0.0", | |
"gulp-watch": "^0.6.9" | |
}, | |
"engines": { | |
"node": ">=0.10.26" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment