Run a single spec with grunt-contrib-jasmine

Chris Wren has written a blog post on Advanced Grunt Tooling, under the section Running individual test specs, he lists an example which allows for naming the spec you would like to run from the command line.


Somebody has done this for you with a --filter command line argument, though it hasn't been pulled into master yet:

https://github.com/gruntjs/grunt-contrib-jasmine/pull/70

filename

grunt jasmine --filter=foo will run spec files that have foo in their file name.

folder

grunt jasmine --filter=/foo will run spec files within folders that have foo* in their name.

wildcard

grunt jasmine --filter=/*-bar will run anything that is located in a folder *-bar

comma separated filters

grunt jasmine --filter=foo,bar will run spec files that have foo or bar in their file name.

flags with space

grunt jasmine --filter="foo bar" will run spec files that have foo bar in their file name.

grunt jasmine --filter="/foo bar" will run spec files within folders that have foo bar* in their name.