updated docs, added styles options, addresses #12

This commit is contained in:
Jarrod Overson 2013-03-10 22:15:29 -07:00
parent da897d09f1
commit 4dbd3ccef7
4 changed files with 37 additions and 24 deletions

View File

@ -60,30 +60,35 @@ Supply your templates that will be used to automatically build the SpecRunner.
#### src #### src
Type: `String|Array` Type: `String|Array`
*Minimatch* - This defines your source files. These are the files that you are testing. *Minimatch* - Your source files. These are the files that you are testing.
#### options.specs #### options.specs
Type: `String|Array` Type: `String|Array`
*Minimatch* - These are your Jasmine specs. *Minimatch* - Your Jasmine specs.
#### options.vendor #### options.vendor
Type: `String|Array` Type: `String|Array`
*Minimatch* - These are third party libraries, generally loaded before anything else happens in your tests. You'll likely add things *Minimatch* - Third party libraries, generally loaded before anything else happens in your tests. Libraries
like jQuery and Backbone here. like jQuery and Backbone.
#### options.helpers #### options.helpers
Type: `String|Array` Type: `String|Array`
*Minimatch* - These are non-source, non-spec helper files. In the default runner these are loaded after `vendor` files *Minimatch* - Non-source, non-spec helper files. In the default runner these are loaded after `vendor` files
#### options.styles
Type: `String|Array`
*Minimatch* - CSS files that get loaded after the jasmine.css
#### options.outfile #### options.outfile
Type: `String` Type: `String`
Default: `_SpecRunner.html` Default: `_SpecRunner.html`
This is the auto-generated specfile that phantomjs will use to run your tests. The auto-generated specfile that phantomjs will use to run your tests.
This is automatically deleted upon normal runs Automatically deleted upon normal runs
#### options.junit.path #### options.junit.path
Type: `String` Type: `String`
@ -101,7 +106,7 @@ Consolidate the JUnit XML so that there is one file per top level suite.
Type: `String` Type: `String`
Default: '' Default: ''
This is the host you want phantomjs to connect against to run your tests. The host you want phantomjs to connect against to run your tests.
e.g. if using an ad hoc server from within grunt e.g. if using an ad hoc server from within grunt
@ -121,7 +126,7 @@ Not defining a host will mean your specs will be run from the local filesystem.
Type: `String` `Object` Type: `String` `Object`
Default: undefined Default: undefined
Specify a custom template used to generate your Spec Runner. Templates are parsed as underscore templates and provided Custom template used to generate your Spec Runner. Parsed as underscore templates and provided
the expanded list of files needed to build a specrunner. the expanded list of files needed to build a specrunner.
You can specify an object with a `process` method that will be called as a template function. You can specify an object with a `process` method that will be called as a template function.
@ -131,13 +136,13 @@ See the [Template API Documentation](https://github.com/gruntjs/grunt-contrib-ja
Type: `Object` Type: `Object`
Default: `{}` Default: `{}`
These options will be passed to your template as an 'options' hash so that you can provide settings to your template. Options that will be passed to your template via an 'options' hash. Used to pass settings to the template.
### Flags ### Flags
Name: `build` Name: `build`
Turn on this flag in order to rebuild the specrunner without deleting it. This is useful when troublshooting templates, Turn on this flag in order to rebuild the specrunner without deleting it. This is useful when troubleshooting templates,
running in a browser, or as part of a watch chain e.g. running in a browser, or as part of a watch chain e.g.
```js ```js
@ -229,4 +234,4 @@ for more information on the RequireJS template.
Task submitted by [Jarrod Overson](http://jarrodoverson.com) Task submitted by [Jarrod Overson](http://jarrodoverson.com)
*This file was generated on Sun Mar 10 2013 21:41:54.* *This file was generated on Sun Mar 10 2013 22:14:38.*

View File

@ -3,30 +3,35 @@
## src ## src
Type: `String|Array` Type: `String|Array`
*Minimatch* - This defines your source files. These are the files that you are testing. *Minimatch* - Your source files. These are the files that you are testing.
## options.specs ## options.specs
Type: `String|Array` Type: `String|Array`
*Minimatch* - These are your Jasmine specs. *Minimatch* - Your Jasmine specs.
## options.vendor ## options.vendor
Type: `String|Array` Type: `String|Array`
*Minimatch* - These are third party libraries, generally loaded before anything else happens in your tests. You'll likely add things *Minimatch* - Third party libraries, generally loaded before anything else happens in your tests. Libraries
like jQuery and Backbone here. like jQuery and Backbone.
## options.helpers ## options.helpers
Type: `String|Array` Type: `String|Array`
*Minimatch* - These are non-source, non-spec helper files. In the default runner these are loaded after `vendor` files *Minimatch* - Non-source, non-spec helper files. In the default runner these are loaded after `vendor` files
## options.styles
Type: `String|Array`
*Minimatch* - CSS files that get loaded after the jasmine.css
## options.outfile ## options.outfile
Type: `String` Type: `String`
Default: `_SpecRunner.html` Default: `_SpecRunner.html`
This is the auto-generated specfile that phantomjs will use to run your tests. The auto-generated specfile that phantomjs will use to run your tests.
This is automatically deleted upon normal runs Automatically deleted upon normal runs
## options.junit.path ## options.junit.path
Type: `String` Type: `String`
@ -44,7 +49,7 @@ Consolidate the JUnit XML so that there is one file per top level suite.
Type: `String` Type: `String`
Default: '' Default: ''
This is the host you want phantomjs to connect against to run your tests. The host you want phantomjs to connect against to run your tests.
e.g. if using an ad hoc server from within grunt e.g. if using an ad hoc server from within grunt
@ -64,7 +69,7 @@ Not defining a host will mean your specs will be run from the local filesystem.
Type: `String` `Object` Type: `String` `Object`
Default: undefined Default: undefined
Specify a custom template used to generate your Spec Runner. Templates are parsed as underscore templates and provided Custom template used to generate your Spec Runner. Parsed as underscore templates and provided
the expanded list of files needed to build a specrunner. the expanded list of files needed to build a specrunner.
You can specify an object with a `process` method that will be called as a template function. You can specify an object with a `process` method that will be called as a template function.
@ -74,13 +79,13 @@ See the [Template API Documentation](https://github.com/gruntjs/grunt-contrib-ja
Type: `Object` Type: `Object`
Default: `{}` Default: `{}`
These options will be passed to your template as an 'options' hash so that you can provide settings to your template. Options that will be passed to your template via an 'options' hash. Used to pass settings to the template.
# Flags # Flags
Name: `build` Name: `build`
Turn on this flag in order to rebuild the specrunner without deleting it. This is useful when troublshooting templates, Turn on this flag in order to rebuild the specrunner without deleting it. This is useful when troubleshooting templates,
running in a browser, or as part of a watch chain e.g. running in a browser, or as part of a watch chain e.g.
```js ```js

View File

@ -37,6 +37,7 @@ module.exports = function(grunt) {
var options = this.options({ var options = this.options({
version : '1.3.1', version : '1.3.1',
timeout : 10000, timeout : 10000,
styles : [],
specs : [], specs : [],
helpers : [], helpers : [],
vendor : [], vendor : [],

View File

@ -44,6 +44,8 @@ exports.init = function(grunt, phantomjs) {
tempDir + '/jasmine.css' tempDir + '/jasmine.css'
]; ];
jasmineCss = jasmineCss.concat(exports.getRelativeFileList(options.styles));
var jasmineCore = [ var jasmineCore = [
tempDir + '/jasmine.js', tempDir + '/jasmine.js',
tempDir + '/jasmine-html.js' tempDir + '/jasmine-html.js'
@ -98,7 +100,7 @@ exports.init = function(grunt, phantomjs) {
if (listItem) files = files.concat(grunt.file.expand({nonull: true},listItem)); if (listItem) files = files.concat(grunt.file.expand({nonull: true},listItem));
}); });
files = grunt.util._(files).map(function(file){ files = grunt.util._(files).map(function(file){
return path.resolve(file).replace(base,'.').replace(/\\/g,'/'); return (/^https?:/).test(file) ? file : path.resolve(file).replace(base,'.').replace(/\\/g,'/');
}); });
return files; return files;
}; };