Skip to content

Instantly share code, notes, and snippets.

@markrendle
Created November 5, 2015 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markrendle/e2a72e5ba4c487f3c439 to your computer and use it in GitHub Desktop.
Save markrendle/e2a72e5ba4c487f3c439 to your computer and use it in GitHub Desktop.
Pass an argument to Gulp to only run a subset of Specs
"use strict";
const gulp = require('gulp'),
mocha = require('gulp-mocha'),
minimist = require('minimist');
const knownOptions = {
string: 'spec',
default: { spec: '*' }
};
const options = minimist(process.argv.slice(2), knownOptions);
gulp.task('test', ['hint'], () => {
return gulp.src([`test/**/${options.spec}Spec.js`], {read: false}) // String interpolation FTW!
.pipe(mocha());
});
gulp.task('default', ['test']);
$ gulp test --spec foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment