2012-11-02 13:03:09 +08:00
# Options
2012-11-02 13:03:09 +08:00
## src
Type: `String|Array`
2014-03-05 02:04:19 +08:00
Your source files. These are the files that you are testing. If you are using RequireJS your source files will be loaded as dependencies into your spec modules and will not need to be placed here.
2012-11-02 13:03:09 +08:00
## options.specs
Type: `String|Array`
2014-01-30 00:51:59 +08:00
Your Jasmine specs.
2012-11-02 13:03:09 +08:00
## options.vendor
Type: `String|Array`
2014-01-30 00:51:59 +08:00
Third party libraries like jQuery & generally anything loaded before source, specs, and helpers.
2012-11-02 13:03:09 +08:00
## options.helpers
Type: `String|Array`
2014-01-30 00:51:59 +08:00
Non-source, non-spec helper files. In the default runner these are loaded after `vendor` files
2013-03-11 13:15:29 +08:00
## options.styles
Type: `String|Array`
2014-01-30 00:51:59 +08:00
CSS files that get loaded after the jasmine.css
2012-11-02 13:03:09 +08:00
2013-04-05 01:57:11 +08:00
## options.version
2015-04-24 02:17:08 +08:00
Type: `String`
Default: '2.2.0'
2013-04-05 01:57:11 +08:00
This is the jasmine-version which will be used. currently available versions are:
2015-04-24 02:17:08 +08:00
* 2.2.0
2014-07-24 05:32:40 +08:00
* 2.0.1
2014-01-30 00:51:59 +08:00
* 2.0.0
*Due to changes in Jasmine, pre-2.0 versions have been dropped and tracking will resume at 2.0.0*
2013-04-05 01:57:11 +08:00
2012-11-02 13:03:09 +08:00
## options.outfile
2013-06-16 03:09:22 +08:00
Type: `String`
2012-11-02 13:03:09 +08:00
Default: `_SpecRunner.html`
2013-03-11 13:15:29 +08:00
The auto-generated specfile that phantomjs will use to run your tests.
2014-01-30 00:51:59 +08:00
Automatically deleted upon normal runs. Use the `:build` flag to generate a SpecRunner manually e.g.
`grunt jasmine:myTask:build`
2013-01-09 03:28:26 +08:00
2013-04-13 08:47:13 +08:00
## options.keepRunner
2013-06-16 03:09:22 +08:00
Type: `Boolean`
Default: `false`
2013-04-13 08:47:13 +08:00
Prevents the auto-generated specfile used to run your tests from being automatically deleted.
2013-01-09 03:28:26 +08:00
## options.junit.path
2013-06-16 03:09:22 +08:00
Type: `String`
2015-10-14 22:06:26 +08:00
Default: `undefined`
2013-01-09 03:28:26 +08:00
Path to output JUnit xml
## options.junit.consolidate
2013-06-16 03:09:22 +08:00
Type: `Boolean`
2013-01-09 03:28:26 +08:00
Default: `false`
Consolidate the JUnit XML so that there is one file per top level suite.
2012-11-02 13:03:09 +08:00
2014-06-01 12:18:53 +08:00
## options.junit.template
Type: `String`
2015-10-14 22:06:26 +08:00
Default: `undefined`
2014-06-01 12:18:53 +08:00
Specify a custom JUnit template instead of using the default `junitTemplate` .
2012-11-02 13:03:09 +08:00
## options.host
2013-06-16 03:09:22 +08:00
Type: `String`
2015-10-14 22:06:26 +08:00
Default: `''`
2012-11-02 13:03:09 +08:00
2014-01-30 00:51:59 +08:00
The host you want PhantomJS to connect against to run your tests.
2012-11-02 13:03:09 +08:00
2012-11-02 13:03:09 +08:00
e.g. if using an ad hoc server from within grunt
2012-11-02 13:03:09 +08:00
2012-11-02 13:03:09 +08:00
```js
2012-12-03 16:17:06 +08:00
host : 'http://127.0.0.1:8000/'
2012-11-02 13:03:09 +08:00
```
2014-01-30 00:51:59 +08:00
Without a `host` , your specs will be run from the local filesystem.
2012-11-02 13:03:09 +08:00
## options.template
2013-06-16 03:09:22 +08:00
Type: `String` `Object`
2015-10-14 22:06:26 +08:00
Default: `undefined`
2012-11-02 13:03:09 +08:00
2013-03-11 13:15:29 +08:00
Custom template used to generate your Spec Runner. Parsed as underscore templates and provided
2012-11-02 13:03:09 +08:00
the expanded list of files needed to build a specrunner.
2012-11-02 13:03:09 +08:00
2013-01-09 03:28:26 +08:00
You can specify an object with a `process` method that will be called as a template function.
2013-01-10 13:14:50 +08:00
See the [Template API Documentation ](https://github.com/gruntjs/grunt-contrib-jasmine/wiki/Jasmine-Templates ) for more details.
2013-01-09 03:28:26 +08:00
2012-11-02 13:03:09 +08:00
## options.templateOptions
2013-06-16 03:09:22 +08:00
Type: `Object`
2012-11-02 13:03:09 +08:00
Default: `{}`
2012-11-02 13:03:09 +08:00
2014-01-30 00:51:59 +08:00
Options that will be passed to your template. Used to pass settings to the template.
2012-11-02 13:03:09 +08:00
2014-09-18 10:12:42 +08:00
## options.polyfills
Type: `String|Array`
Third party polyfill libraries like json2 that are loaded at the very top before anything else. es5-shim is loaded automatically with this library.
2014-02-27 04:12:10 +08:00
## options.display
Type: `String`
2015-10-14 22:06:26 +08:00
Default: `'full'`
2014-02-27 04:12:10 +08:00
* `full` displays the full specs tree
* `short` only displays a success or failure character for each test (useful with large suites)
2014-06-08 06:07:02 +08:00
* `none` displays nothing
2014-02-27 04:12:10 +08:00
2014-02-28 06:06:29 +08:00
## options.summary
Type: `Boolean`
Default: `false`
Display a list of all failed tests and their failure messages
2012-11-09 08:57:30 +08:00
# Flags
Name: `build`
2014-01-30 00:51:59 +08:00
Turn on this flag in order to build a SpecRunner html file. This is useful when troubleshooting templates,
2012-12-03 16:17:06 +08:00
running in a browser, or as part of a watch chain e.g.
2012-11-09 08:57:30 +08:00
```js
2012-12-03 16:17:06 +08:00
watch: {
pivotal : {
files: ['src/**/*.js', 'specs/**/*.js'],
tasks: 'jasmine:pivotal:build'
2012-11-09 08:57:30 +08:00
}
2012-12-03 16:17:06 +08:00
}
2012-11-09 08:57:30 +08:00
```
2013-09-03 02:03:05 +08:00
# Filtering specs
**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.