Here is my Gruntfile jasmine config task. I've added jquery and jasmine-jquery via vendor options.
jasmine: {
src: {
src: '<%= paths.dist %>/**/*.js',
options: {
specs: '<%= paths.tests %>/specs/*Spec.js',
helpers: '<%= paths.tests %>/helpers/*Helper.js',
outfile: '<%= paths.tests %>/_SpecRunner.html'
},
vendor: [
"<%= paths.bower %>/jquery/dist/jquery.js",
"<%= paths.bower %>/jasmine-jquery/lib/jasmine-jquery.js"
]
}
},
After running grunt gets errors. Looks like grunt-jasmine don't including vendors setted in task.
Running "jasmine:src" (jasmine) task
Testing jasmine specs via PhantomJS
>> ReferenceError: Can't find variable: jQuery at
>> dist/script.js:97
Core
X should return element
ReferenceError: Can't find variable: $ in file:///Users/jedrzejchalubek/Dropbox/Script/tests/specs/CoreSpec.js (line 6) (1)
ReferenceError: Can't find variable: $ in file:///Users/jedrzejchalubek/Dropbox/Script/tests/specs/CoreSpec.js (line 10) (2)
Oh, It's my fault. Vendor need to be inside options. Task config should look like this:
jasmine: {
src: {
src: '<%= paths.dist %>/**/*.js',
options: {
specs: '<%= paths.tests %>/specs/*Spec.js',
helpers: '<%= paths.tests %>/helpers/*Helper.js',
outfile: '<%= paths.tests %>/_SpecRunner.html',
vendor: [
"<%= paths.bower %>/jquery/dist/jquery.js",
"<%= paths.bower %>/jasmine-jquery/lib/jasmine-jquery.js"
]
},
}
}