Skip to content

Instantly share code, notes, and snippets.

@felixrabe
Created May 30, 2014 17:20
Show Gist options
  • Save felixrabe/3f6025286958f870f720 to your computer and use it in GitHub Desktop.
Save felixrabe/3f6025286958f870f720 to your computer and use it in GitHub Desktop.
Gulpfile.coffee with conditionally suppressed [gulp] output
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