Created
May 30, 2014 17:20
-
-
Save felixrabe/3f6025286958f870f720 to your computer and use it in GitHub Desktop.
Gulpfile.coffee with conditionally suppressed [gulp] output
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
gulp = require 'gulp' | |
gutil = require 'gulp-util' | |
mocha = require 'gulp-mocha' | |
taskNameStartsWithMetaDash = false | |
for arg in process.argv[2..] | |
if arg.substr(0, 5) == 'meta-' | |
taskNameStartsWithMetaDash = true | |
break | |
unless taskNameStartsWithMetaDash | |
# Suppress [gulp] output: | |
# https://github.com/gulpjs/gulp/issues/499 | |
# http://stackoverflow.com/a/22579569/1034080 | |
consoleLogOrig = console.log | |
console.log = (args...) -> | |
return if args.length and /^\[.*gulp.*\]$/.test(args[0]) | |
consoleLogOrig.apply console, args | |
gulp.task 'meta-test', -> | |
mochaOpts = | |
reporter: 'spec' | |
globals: | |
assert: require('chai').assert | |
should: require('chai').should() | |
gulp | |
.src 'test-meta/**/*.coffee', read: false | |
.pipe mocha(mochaOpts) | |
gulp.task 'hello', -> | |
console.log 'hello' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment