Permalink
Browse files

Fixed race condition with requirejs template

  • Loading branch information...
1 parent 9a71d17 commit d44d81448b6bd865a0c028bc9218c59b951528d2 @jsoverson jsoverson committed Nov 2, 2012
Showing with 32,240 additions and 61 deletions.
  1. +2 −1 .editorconfig
  2. +2 −0 .gitignore
  3. +2 −0 .travis.yml
  4. +6 −2 CHANGELOG
  5. +43 −3 Gruntfile.js
  6. +172 −25 README.md
  7. +66 −1 docs/jasmine-examples.md
  8. +62 −21 docs/jasmine-options.md
  9. +41 −1 docs/jasmine-overview.md
  10. +4 −1 package.json
  11. +201 −5 tasks/jasmine.js
  12. +31 −0 tasks/jasmine/jasmine-helper.js
  13. +187 −0 tasks/jasmine/reporters/JUnitReporter.js
  14. +193 −0 tasks/jasmine/reporters/PhantomReporter.js
  15. +21 −0 tasks/jasmine/templates/DefaultRunner.tmpl
  16. +44 −0 tasks/jasmine/templates/RequireJSRunner.tmpl
  17. +67 −0 tasks/lib/jasmine.js
  18. +21 −0 test/fixtures/customTemplate/custom.tmpl
  19. +53 −0 test/fixtures/pivotal/SpecRunner.html
  20. +20 −0 test/fixtures/pivotal/lib/jasmine-1.2.0/MIT.LICENSE
  21. +616 −0 test/fixtures/pivotal/lib/jasmine-1.2.0/jasmine-html.js
  22. +81 −0 test/fixtures/pivotal/lib/jasmine-1.2.0/jasmine.css
  23. +2,529 −0 test/fixtures/pivotal/lib/jasmine-1.2.0/jasmine.js
  24. +58 −0 test/fixtures/pivotal/spec/PlayerSpec.js
  25. +9 −0 test/fixtures/pivotal/spec/SpecHelper.js
  26. +22 −0 test/fixtures/pivotal/src/Player.js
  27. +7 −0 test/fixtures/pivotal/src/Song.js
  28. +10 −0 test/fixtures/requirejs/spec/SumSpec.js
  29. +5 −0 test/fixtures/requirejs/src/math.js
  30. +5 −0 test/fixtures/requirejs/src/sum.js
  31. +2 −1 test/jasmine_test.js
  32. +2 −0 vendor/jasmine/.rspec
  33. +45 −0 vendor/jasmine/Contribute.markdown
  34. +3 −0 vendor/jasmine/Gemfile
  35. +20 −0 vendor/jasmine/MIT.LICENSE
  36. +24 −0 vendor/jasmine/README.markdown
  37. +44 −0 vendor/jasmine/Rakefile
  38. +42 −0 vendor/jasmine/Release.markdown
  39. +15 −0 vendor/jasmine/SpecRunner.html
  40. +29 −0 vendor/jasmine/config.rb
  41. BIN vendor/jasmine/images/jasmine_favicon.png
  42. +32 −0 vendor/jasmine/jasmine-core.gemspec
  43. +1 −0 vendor/jasmine/jasmine_dev.thor
  44. +17 −0 vendor/jasmine/jsdoc-template/allclasses.tmpl
  45. +56 −0 vendor/jasmine/jsdoc-template/allfiles.tmpl
  46. +646 −0 vendor/jasmine/jsdoc-template/class.tmpl
  47. +39 −0 vendor/jasmine/jsdoc-template/index.tmpl
  48. +184 −0 vendor/jasmine/jsdoc-template/publish.js
  49. +162 −0 vendor/jasmine/jsdoc-template/static/default.css
  50. +2 −0 vendor/jasmine/jsdoc-template/static/header.html
  51. +19 −0 vendor/jasmine/jsdoc-template/static/index.html
  52. +35 −0 vendor/jasmine/jsdoc-template/symbol.tmpl
  53. +5,919 −0 vendor/jasmine/jshint/jshint.js
  54. +99 −0 vendor/jasmine/jshint/run.js
  55. +36 −0 vendor/jasmine/lib/jasmine-core.rb
  56. +54 −0 vendor/jasmine/lib/jasmine-core/example/SpecRunner.html
  57. +58 −0 vendor/jasmine/lib/jasmine-core/example/spec/PlayerSpec.js
  58. +9 −0 vendor/jasmine/lib/jasmine-core/example/spec/SpecHelper.js
  59. +22 −0 vendor/jasmine/lib/jasmine-core/example/src/Player.js
  60. +7 −0 vendor/jasmine/lib/jasmine-core/example/src/Song.js
  61. +681 −0 vendor/jasmine/lib/jasmine-core/jasmine-html.js
  62. +82 −0 vendor/jasmine/lib/jasmine-core/jasmine.css
  63. +2,538 −0 vendor/jasmine/lib/jasmine-core/jasmine.js
  64. +478 −0 vendor/jasmine/lib/jasmine-core/json2.js
  65. +451 −0 vendor/jasmine/lib/jasmine-core/spec/console/ConsoleReporterSpec.js
  66. +27 −0 vendor/jasmine/lib/jasmine-core/spec/core/BaseSpec.js
  67. +97 −0 vendor/jasmine/lib/jasmine-core/spec/core/CustomMatchersSpec.js
  68. +159 −0 vendor/jasmine/lib/jasmine-core/spec/core/EnvSpec.js
  69. +175 −0 vendor/jasmine/lib/jasmine-core/spec/core/ExceptionsSpec.js
  70. +103 −0 vendor/jasmine/lib/jasmine-core/spec/core/JsApiReporterSpec.js
  71. +1,116 −0 vendor/jasmine/lib/jasmine-core/spec/core/MatchersSpec.js
  72. +38 −0 vendor/jasmine/lib/jasmine-core/spec/core/MockClockSpec.js
  73. +45 −0 vendor/jasmine/lib/jasmine-core/spec/core/MultiReporterSpec.js
  74. +54 −0 vendor/jasmine/lib/jasmine-core/spec/core/NestedResultsSpec.js
  75. +94 −0 vendor/jasmine/lib/jasmine-core/spec/core/PrettyPrintSpec.js
  76. +23 −0 vendor/jasmine/lib/jasmine-core/spec/core/QueueSpec.js
  77. +56 −0 vendor/jasmine/lib/jasmine-core/spec/core/ReporterSpec.js
  78. +267 −0 vendor/jasmine/lib/jasmine-core/spec/core/RunnerSpec.js
  79. +1,258 −0 vendor/jasmine/lib/jasmine-core/spec/core/SpecRunningSpec.js
  80. +124 −0 vendor/jasmine/lib/jasmine-core/spec/core/SpecSpec.js
  81. +201 −0 vendor/jasmine/lib/jasmine-core/spec/core/SpySpec.js
  82. +120 −0 vendor/jasmine/lib/jasmine-core/spec/core/SuiteSpec.js
  83. +39 −0 vendor/jasmine/lib/jasmine-core/spec/core/UtilSpec.js
  84. +118 −0 vendor/jasmine/lib/jasmine-core/spec/core/WaitsForBlockSpec.js
  85. +209 −0 vendor/jasmine/lib/jasmine-core/spec/html/HTMLReporterSpec.js
  86. +38 −0 vendor/jasmine/lib/jasmine-core/spec/html/MatchersHtmlSpec.js
  87. +8 −0 vendor/jasmine/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js
  88. +239 −0 vendor/jasmine/lib/jasmine-core/spec/html/TrivialReporterSpec.js
  89. +127 −0 vendor/jasmine/lib/jasmine-core/spec/node_suite.js
  90. +86 −0 vendor/jasmine/lib/jasmine-core/spec/runner.html
  91. +51 −0 vendor/jasmine/lib/jasmine-core/spec/spec_helper.rb
  92. +33 −0 vendor/jasmine/lib/jasmine-core/spec/tasks/build_distribution_spec.rb
  93. +60 −0 vendor/jasmine/lib/jasmine-core/spec/tasks/build_github_pages_spec.rb
  94. +109 −0 vendor/jasmine/lib/jasmine-core/spec/tasks/build_standalone_distribution_spec.rb
  95. +63 −0 vendor/jasmine/lib/jasmine-core/spec/tasks/build_standalone_runner_spec.rb
  96. +26 −0 vendor/jasmine/lib/jasmine-core/spec/tasks/count_specs_spec.rb
  97. +81 −0 vendor/jasmine/lib/jasmine-core/spec/tasks/execute_specs_spec.rb
  98. +39 −0 vendor/jasmine/lib/jasmine-core/spec/tasks/jshint_spec.rb
  99. +39 −0 vendor/jasmine/lib/jasmine-core/spec/tasks/release_spec.rb
  100. +55 −0 vendor/jasmine/lib/jasmine-core/spec/tasks/version_spec.rb
  101. +49 −0 vendor/jasmine/lib/jasmine-core/spec/templates/runner.html.erb
  102. +1 −0 vendor/jasmine/lib/jasmine-core/spec/templates/script_tag.html.erb
  103. +6 −0 vendor/jasmine/lib/jasmine-core/version.rb
  104. +451 −0 vendor/jasmine/spec/console/ConsoleReporterSpec.js
  105. +27 −0 vendor/jasmine/spec/core/BaseSpec.js
  106. +97 −0 vendor/jasmine/spec/core/CustomMatchersSpec.js
  107. +159 −0 vendor/jasmine/spec/core/EnvSpec.js
  108. +175 −0 vendor/jasmine/spec/core/ExceptionsSpec.js
  109. +103 −0 vendor/jasmine/spec/core/JsApiReporterSpec.js
  110. +1,116 −0 vendor/jasmine/spec/core/MatchersSpec.js
  111. +38 −0 vendor/jasmine/spec/core/MockClockSpec.js
  112. +45 −0 vendor/jasmine/spec/core/MultiReporterSpec.js
  113. +54 −0 vendor/jasmine/spec/core/NestedResultsSpec.js
  114. +94 −0 vendor/jasmine/spec/core/PrettyPrintSpec.js
  115. +23 −0 vendor/jasmine/spec/core/QueueSpec.js
  116. +56 −0 vendor/jasmine/spec/core/ReporterSpec.js
  117. +267 −0 vendor/jasmine/spec/core/RunnerSpec.js
  118. +1,258 −0 vendor/jasmine/spec/core/SpecRunningSpec.js
  119. +124 −0 vendor/jasmine/spec/core/SpecSpec.js
  120. +201 −0 vendor/jasmine/spec/core/SpySpec.js
  121. +120 −0 vendor/jasmine/spec/core/SuiteSpec.js
  122. +39 −0 vendor/jasmine/spec/core/UtilSpec.js
  123. +118 −0 vendor/jasmine/spec/core/WaitsForBlockSpec.js
  124. +209 −0 vendor/jasmine/spec/html/HTMLReporterSpec.js
  125. +38 −0 vendor/jasmine/spec/html/MatchersHtmlSpec.js
  126. +8 −0 vendor/jasmine/spec/html/PrettyPrintHtmlSpec.js
  127. +239 −0 vendor/jasmine/spec/html/TrivialReporterSpec.js
  128. +127 −0 vendor/jasmine/spec/node_suite.js
  129. +86 −0 vendor/jasmine/spec/runner.html
  130. +51 −0 vendor/jasmine/spec/spec_helper.rb
  131. +33 −0 vendor/jasmine/spec/tasks/build_distribution_spec.rb
  132. +60 −0 vendor/jasmine/spec/tasks/build_github_pages_spec.rb
  133. +109 −0 vendor/jasmine/spec/tasks/build_standalone_distribution_spec.rb
  134. +63 −0 vendor/jasmine/spec/tasks/build_standalone_runner_spec.rb
  135. +26 −0 vendor/jasmine/spec/tasks/count_specs_spec.rb
  136. +81 −0 vendor/jasmine/spec/tasks/execute_specs_spec.rb
  137. +39 −0 vendor/jasmine/spec/tasks/jshint_spec.rb
  138. +39 −0 vendor/jasmine/spec/tasks/release_spec.rb
  139. +55 −0 vendor/jasmine/spec/tasks/version_spec.rb
  140. +49 −0 vendor/jasmine/spec/templates/runner.html.erb
  141. +1 −0 vendor/jasmine/spec/templates/script_tag.html.erb
  142. +177 −0 vendor/jasmine/src/console/ConsoleReporter.js
  143. +27 −0 vendor/jasmine/src/core/Block.js
  144. +277 −0 vendor/jasmine/src/core/Env.js
  145. +102 −0 vendor/jasmine/src/core/JsApiReporter.js
  146. +397 −0 vendor/jasmine/src/core/Matchers.js
  147. +35 −0 vendor/jasmine/src/core/MultiReporter.js
  148. +80 −0 vendor/jasmine/src/core/NestedResults.js
  149. +123 −0 vendor/jasmine/src/core/PrettyPrinter.js
  150. +99 −0 vendor/jasmine/src/core/Queue.js
  151. +31 −0 vendor/jasmine/src/core/Reporter.js
  152. +77 −0 vendor/jasmine/src/core/Runner.js
  153. +243 −0 vendor/jasmine/src/core/Spec.js
  154. +82 −0 vendor/jasmine/src/core/Suite.js
  155. +15 −0 vendor/jasmine/src/core/WaitsBlock.js
  156. +54 −0 vendor/jasmine/src/core/WaitsForBlock.js
  157. +639 −0 vendor/jasmine/src/core/base.js
  158. +183 −0 vendor/jasmine/src/core/mock-timeout.js
  159. +67 −0 vendor/jasmine/src/core/util.js
  160. +165 −0 vendor/jasmine/src/html/HtmlReporter.js
  161. +60 −0 vendor/jasmine/src/html/HtmlReporterHelpers.js
  162. +164 −0 vendor/jasmine/src/html/ReporterView.js
  163. +79 −0 vendor/jasmine/src/html/SpecView.js
  164. +22 −0 vendor/jasmine/src/html/SuiteView.js
  165. +192 −0 vendor/jasmine/src/html/TrivialReporter.js
  166. +309 −0 vendor/jasmine/src/html/_HTMLReporter.scss
  167. +169 −0 vendor/jasmine/src/html/_TrivialReporter.scss
  168. +82 −0 vendor/jasmine/src/html/jasmine.css
  169. +2 −0 vendor/jasmine/src/html/jasmine.scss
  170. +3 −0 vendor/jasmine/src/templates/example_project_jasmine_tags.html.erb
  171. +7 −0 vendor/jasmine/src/templates/version.js.erb
  172. +6 −0 vendor/jasmine/src/templates/version.rb.erb
  173. +7 −0 vendor/jasmine/src/version.js
  174. +5 −0 vendor/jasmine/src/version.json
  175. +17 −0 vendor/jasmine/tasks/docs.rb
  176. +18 −0 vendor/jasmine/tasks/jasmine_dev.rb
  177. +54 −0 vendor/jasmine/tasks/jasmine_dev/base.rb
  178. +53 −0 vendor/jasmine/tasks/jasmine_dev/build_distribution.rb
  179. +28 −0 vendor/jasmine/tasks/jasmine_dev/build_github_pages.rb
  180. +49 −0 vendor/jasmine/tasks/jasmine_dev/build_standalone_distribution.rb
  181. +59 −0 vendor/jasmine/tasks/jasmine_dev/build_standalone_runner.rb
  182. +29 −0 vendor/jasmine/tasks/jasmine_dev/count_specs.rb
  183. +52 −0 vendor/jasmine/tasks/jasmine_dev/execute_specs.rb
  184. +13 −0 vendor/jasmine/tasks/jasmine_dev/js_hint.rb
  185. +16 −0 vendor/jasmine/tasks/jasmine_dev/release.rb
  186. +32 −0 vendor/jasmine/tasks/jasmine_dev/sources.rb
  187. +62 −0 vendor/jasmine/tasks/jasmine_dev/version.rb
  188. +34 −0 vendor/require-2.1.1.js
View
@@ -2,7 +2,8 @@
root = true
[*]
-indent_style = tab
+indent_style = space
+indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
View
@@ -2,3 +2,5 @@ node_modules
npm-debug.log
tmp
.idea
+tmp
+
View
@@ -1,3 +1,5 @@
language: node_js
node_js:
- 0.8
+before_script:
+ - npm install grunt-cli
View
@@ -1,4 +1,8 @@
+v0.1.1:
+ date: 2012-11-07
+ changes:
+ - Fixed race condition in requirejs template
v0.1.0:
- date: 2012-11-01
+ date: 2012-11-07
changes:
- - Work in progress, not yet officially released.
+ - Ported grunt-jasmine-runner and grunt-jasmine-task to grunt-contrib
View
@@ -13,12 +13,48 @@ module.exports = function(grunt) {
jshint: {
all: [
'Gruntfile.js',
- 'tasks/*.js'
+ 'tasks/**/*.js'
],
options: {
jshintrc: '.jshintrc'
}
},
+ watch: {
+ files: ['test/fixtures/pivotal/**/*.js'],
+ tasks: 'jasmine:pivotal:build'
+ },
+ connect : {
+ port : 8000,
+ base : '.'
+ },
+ jasmine : {
+ options : {
+ specs : 'test/fixtures/pivotal/spec/*Spec.js',
+ helpers : 'test/fixtures/pivotal/spec/*Helper.js'
+ },
+ pivotal : {
+ src : 'test/fixtures/pivotal/src/**/*.js'
+ },
+ customTemplate : {
+ src : 'test/fixtures/pivotal/src/**/*.js',
+ options : {
+ template : 'test/fixtures/customTemplate/custom.tmpl'
+ }
+ },
+ requirejs : {
+ src : 'test/fixtures/requirejs/src/**/*.js',
+ options : {
+ specs : 'test/fixtures/requirejs/spec/*Spec.js',
+ helpers : 'test/fixtures/requirejs/spec/*Helper.js',
+ host : 'http://127.0.0.1:<%= connect.port %>/',
+ template : 'requirejs',
+ templateOptions : {
+ baseUrl : './test/fixtures/requirejs/src/'
+// requirejs : 'vendor/require-2.1.1.js'
+ }
+ }
+ }
+ },
nodeunit: {
tasks: ['test/*_test.js']
}
@@ -28,8 +64,12 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
+ grunt.loadNpmTasks('grunt-contrib-connect');
+ grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-internal');
- grunt.registerTask('test', ['jasmine', 'nodeunit']);
- grunt.registerTask('default', ['test', 'build-contrib']);
+ grunt.registerTask('watch-test', ['connect', 'watch']);
+
+ grunt.registerTask('test', ['jasmine:pivotal', 'jasmine:customTemplate', 'connect', 'jasmine:requirejs', 'nodeunit']);
+ grunt.registerTask('default', ['jshint', 'test', 'build-contrib']);
};
View
197 README.md
@@ -28,54 +28,201 @@ If the plugin has been installed correctly, running `grunt --help` at the comman
## The jasmine task
-#### Overview
+### Overview
+
+grunt-contrib-jasmine automatically builds and maintains your spec runner and runs your tests headlessly through
+phantomjs
+
+Substantial credit goes to [Camille Reynders](http://creynders.be/) (@creynders) for the first decent implementation
+of jasmine through grunt which served as motivation for all the future work.
+
+#### Run specs locally or on an ad hoc server
+
+Run your tests on your local filesystem or via a server task like [grunt-contrib-connect][].
+
+#### AMD Support
+
+Includes a SpecRunner template customized for use with AMD modules and requirejs.
+
+#### Customize your SpecRunner with your own template
+
+Supply your own underscore template to automatically build your SpecRunner custom to your use.
+
+### Flags
+
+Name: `build`
+
+Specify this flag in order to rebuild the specrunner and not delete it. This is useful when troublshooting templates,
+running in a browser, or as part of a watch chain for use in a web browser, e.g.
+
+```js
+ watch: {
+ pivotal : {
+ files: ['test/fixtures/pivotal/**/*.js'],
+ tasks: 'jasmine:pivotal:build'
+ }
+ }
+```
+
+```js
+ grunt.registerTask('dev', ['connect', 'watch']);
+```
+
+[grunt-contrib-connect]: https://github.com/gruntjs/grunt-contrib-connect
+
### Options
-#### option1
-Type: `Integer`
-Default: `8080`
+#### src
+Type: `String|Array`
+
+*Minimatch* - This defines your source files. These are the files that you are testing.
-descr
+#### options.specs
+Type: `String|Array`
-#### option2
-Type: `String`
-Default: `foo`
+*Minimatch* - These are your Jasmine specs.
-descr
+#### options.vendor
+Type: `String|Array`
-#### option3
-Type: `String`
-Default: `.`
+*Minimatch* - These are third party libraries, generally loaded before anything else happens in your tests. You'll likely add things
+like jQuery and Backbone here.
-descr
+#### options.helpers
+Type: `String|Array`
-#### option4
-Type: `Boolean`
-Default: `false`
+*Minimatch* - These are non-source, non-spec helper files. In the default runner these are loaded after `vendor` files
-descr
+#### options.outfile
+Type: `String`
+Default: `_SpecRunner.html`
-#### options5
-Type: `Function`
-Default:
+This is the auto-generated specfile that phantomjs will use to run your tests. This is automatically deleted upon normal
+runs
+
+#### options.host
+Type: `String`
+Default: ''
+
+This is the host you want phantomjs to connect against to run your tests.
+
+e.g. if using an ad hoc server from within grunt
```js
-function() {
-}
+ host : 'http://127.0.0.1:8000/'
+```
+
+Or, using templates
+
+```js
+ host : 'http://127.0.0.1:<%= connect.port %>/'
+```
+
+Not defining a host will mean your specs will be run from the local filesystem.
+
+#### options.template
+Type: `String`
+Default: `default`
+Options: `default`, `requirejs`, `yourcustomtemplate.tmpl`
+
+Specify a custom template to use when generating your Spec Runner. Templates are parsed as underscore templates and provided
+the expanded list of files needed to build a specrunner.
+
+#### options.templateOptions
+Type: `Object`
+Default: `{}`
+
+These options will be passed to your template as an 'options' hash so that you can provide settings to your template.
+
+**'requirejs'** default templateOptions :
+
+```js
+ requirejs : __dirname + '/../vendor/require-#.#.#.js',
+ baseUrl : ''
```
-### Usage examples
+- requirejs : the location of the included requirejs.
+- baseUrl : set in `require.config({})`, sets the baseUrl for your modules (usually the directory your 'src' files are located in.
+
+
+
#### Basic Use
+Sample configuration to run Pivotal Labs' example Jasmine application.
+
+```js
+jasmine : {
+ pivotal : {
+ src : 'test/fixtures/pivotal/src/**/*.js'
+ options : {
+ specs : 'test/fixtures/pivotal/spec/*Spec.js',
+ helpers : 'test/fixtures/pivotal/spec/*Helper.js'
+ }
+ }
+}
+```
+
+#### Supplying a custom template
+
+Supplying a custom template to the above example
+
+```js
+jasmine : {
+ customTemplate : {
+ src : 'test/fixtures/pivotal/src/**/*.js',
+ options : {
+ specs : 'test/fixtures/pivotal/spec/*Spec.js',
+ helpers : 'test/fixtures/pivotal/spec/*Helper.js'
+ template : 'test/fixtures/customTemplate/custom.tmpl'
+ }
+ }
+}
+```
+
+#### Sample RequireJS usage
+
+```js
+jasmine : {
+ requirejs : {
+ src : 'test/fixtures/requirejs/src/**/*.js',
+ options : {
+ specs : 'test/fixtures/requirejs/spec/*Spec.js',
+ helpers : 'test/fixtures/requirejs/spec/*Helper.js',
+ host : 'http://127.0.0.1:<%= connect.port %>/',
+ template : 'requirejs',
+ templateOptions : {
+ baseUrl : './test/fixtures/requirejs/src/'
+ }
+ }
+ }
+}
+```
+
+#### RequireJS note
+
+If you end up using the requirejs template, it's worth looking at the [RequireJS template](blob/master/tasks/jasmine/templates/RequireJSRunner.tmpl) in order to
+familiarize yourself with how it loads your files. The gist of it is:
+
+```js
+require([*YOUR SOURCE*], function() {
+ require([*YOUR SPECS*], function() {
+ require([*JASMINE FILES*], function() {
+ // at this point your tests are already running.
+ }
+ }
+}
+```
+
## Release History
- * 2012-10-31 - v0.1.0 - Work in progress, not yet officially released.
+ * 2012-11-06 - v0.1.1 - Fixed race condition in requirejs template
+ * 2012-11-06 - v0.1.0 - Ported grunt-jasmine-runner and grunt-jasmine-task to grunt-contrib
--
Task submitted by <a href="http://jarrodoverson.com">Jarrod Overson</a>.
-*Generated on Thu Nov 01 2012 22:01:17.*
+*Generated on Wed Nov 07 2012 10:53:51.*
View
@@ -1,3 +1,68 @@
-# Usage examples
+
## Basic Use
+
+Sample configuration to run Pivotal Labs' example Jasmine application.
+
+```js
+jasmine : {
+ pivotal : {
+ src : 'test/fixtures/pivotal/src/**/*.js'
+ options : {
+ specs : 'test/fixtures/pivotal/spec/*Spec.js',
+ helpers : 'test/fixtures/pivotal/spec/*Helper.js'
+ }
+ }
+}
+```
+
+## Supplying a custom template
+
+Supplying a custom template to the above example
+
+```js
+jasmine : {
+ customTemplate : {
+ src : 'test/fixtures/pivotal/src/**/*.js',
+ options : {
+ specs : 'test/fixtures/pivotal/spec/*Spec.js',
+ helpers : 'test/fixtures/pivotal/spec/*Helper.js'
+ template : 'test/fixtures/customTemplate/custom.tmpl'
+ }
+ }
+}
+```
+
+## Sample RequireJS usage
+
+```js
+jasmine : {
+ requirejs : {
+ src : 'test/fixtures/requirejs/src/**/*.js',
+ options : {
+ specs : 'test/fixtures/requirejs/spec/*Spec.js',
+ helpers : 'test/fixtures/requirejs/spec/*Helper.js',
+ host : 'http://127.0.0.1:<%= connect.port %>/',
+ template : 'requirejs',
+ templateOptions : {
+ baseUrl : './test/fixtures/requirejs/src/'
+ }
+ }
+ }
+}
+```
+
+## RequireJS note
+
+If you end up using the requirejs template, it's worth looking at the [RequireJS template](blob/master/tasks/jasmine/templates/RequireJSRunner.tmpl) in order to
+familiarize yourself with how it loads your files. The gist of it is:
+
+```js
+require([*YOUR SOURCE*], function() {
+ require([*YOUR SPECS*], function() {
+ require([*JASMINE FILES*], function() {
+ // at this point your tests are already running.
+ }
+ }
+}
+```
Oops, something went wrong.

0 comments on commit d44d814

Please sign in to comment.