Pass an argument to Gulp to only run a subset of Specs
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
"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']); |
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 test --spec foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment