grunt-contrib-jasmine/docs/jasmine-options.md

140 lines
3.5 KiB
Markdown
Raw Normal View History

2012-11-02 13:03:09 +08:00
# Options
## src
Type: `String|Array`
2014-01-30 00:51:59 +08:00
Your source files. These are the files that you are testing.
## options.specs
Type: `String|Array`
2014-01-30 00:51:59 +08:00
Your Jasmine specs.
## 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.
## 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
## options.styles
Type: `String|Array`
2014-01-30 00:51:59 +08:00
CSS files that get loaded after the jasmine.css
2013-04-05 01:57:11 +08:00
## options.version
2013-06-16 03:09:22 +08:00
Type: `String`
2014-01-30 00:51:59 +08:00
Default: '2.0.0'
2013-04-05 01:57:11 +08:00
This is the jasmine-version which will be used. currently available versions are:
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
## options.outfile
2013-06-16 03:09:22 +08:00
Type: `String`
Default: `_SpecRunner.html`
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`
## options.keepRunner
2013-06-16 03:09:22 +08:00
Type: `Boolean`
Default: `false`
Prevents the auto-generated specfile used to run your tests from being automatically deleted.
## options.junit.path
2013-06-16 03:09:22 +08:00
Type: `String`
Default: undefined
Path to output JUnit xml
## options.junit.consolidate
2013-06-16 03:09:22 +08:00
Type: `Boolean`
Default: `false`
Consolidate the JUnit XML so that there is one file per top level suite.
2012-11-02 13:03:09 +08:00
## options.host
2013-06-16 03:09:22 +08:00
Type: `String`
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
e.g. if using an ad hoc server from within grunt
2012-11-02 13:03:09 +08:00
```js
host : 'http://127.0.0.1:8000/'
```
2014-01-30 00:51:59 +08:00
Without a `host`, your specs will be run from the local filesystem.
## options.template
2013-06-16 03:09:22 +08:00
Type: `String` `Object`
Default: undefined
2012-11-02 13:03:09 +08:00
Custom template used to generate your Spec Runner. Parsed as underscore templates and provided
the expanded list of files needed to build a specrunner.
2012-11-02 13:03:09 +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.
## options.templateOptions
2013-06-16 03:09:22 +08:00
Type: `Object`
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
## options.display
Type: `String`
Default: `full`
* `full` displays the full specs tree
* `short` only displays a success or failure character for each test (useful with large suites)
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
# 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,
running in a browser, or as part of a watch chain e.g.
```js
watch: {
pivotal : {
files: ['src/**/*.js', 'specs/**/*.js'],
tasks: 'jasmine:pivotal:build'
}
}
```
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.