Question

I have my gulpfile.coffee

gulp  = require 'gulp'

coffeelint = require 'gulp-coffeelint'
mocha      = require 'gulp-mocha'
plumber    = require 'gulp-plumber'
gutil      = require 'gulp-util'
watch      = require 'gulp-watch'

handleError = (err) ->
  console.error err.message
  process.exit 1

gulp.task 'test', ->
  gulp.src('test/*-test.*')
    .pipe(mocha(reporter: 'spec'))
    .on 'error', handleError

I need run gulp test --grep group1, i found options.grep but i don't know how proceed parameter from CLI.

Was it helpful?

Solution

SOLVED: using yargs npm package

gulp  = require 'gulp'

coffeelint = require 'gulp-coffeelint'
mocha      = require 'gulp-mocha'
plumber    = require 'gulp-plumber'
gutil      = require 'gulp-util'
watch      = require 'gulp-watch'
yargs      = require 'yargs'

handleError = (err) ->
  console.error err.message
  process.exit 1

gulp.task 'test', ->
  gulp.src('test/*-test.*')
    .pipe(mocha(reporter: 'spec', grep: yargs.argv.grep))
    .on 'error', handleError
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top