How would I, on the command-line, specify a single specfile to run when using grunt-contrib-jasmine? My jasmine section looks something like:
jasmine: {
myapp: {
src: [ 'src/base.js', 'src/**/*.js' ]
},
options: {
spec: [
'spec/models/**/*.js',
'spec/views/**/*.js'
]
}
}
I just want to run the tests for spec/models/file1.js
.
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 *-barcomma 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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With