-
Notifications
You must be signed in to change notification settings - Fork 346
TypeError: 'undefined' is not a function (evaluating 'jasmine.addMatchers') #168
Comments
I had the same problem. It seems to be an issue with the version of jasmine-jquery.js and the version of jasmine.js that karma is using. I found a workaround, I use an older version of jasmine-jquery (1.3.1): http://cloud.github.com/downloads/velesin/jasmine-jquery/jasmine-jquery-1.3.1.js |
karma-jasmine only supports jasmine 1.x so you need to use jasmine-jquery < 2. edit (july 7): karma-jasmine v0.2.0+ now supports jasmine 2 |
Thank you for help |
As a note for future users who are trying to get this to work, you don't need to go as far back as version 1.3. 1.3 didn't have the |
where can we download 1.7 from @hxu ? |
@thebookworm101 If you're using bower, you can set the version in your bower file. Or, here's the link to that git tag on GitHub. |
thanks for making a note of this guys! for posterity a reminder to others: make sure to restart karma to see this change take effect. :) |
In regards to the comment that karma-jasmine only supports jasmine 1.x, karma-jasmine does in fact now support jasmine 2.0. Put |
thanks, updated my comment |
I am using yeoman angular-generator to set up the project, then by default it is using karma runner to make the unit test. The problem is after includes the jasmine-jquery pulgin, the karma unit test does not work.
The error message is :
TypeError: 'undefined' is not a function (evaluating 'jasmine.addMatchers')
at ../app/bower_components/jasmine-jquery/lib/jasmine-jquery.js:716
at ../node_modules/karma-jasmine/lib/adapter.js:166
Here is my karma.conf.js:
module.exports = function(config) {
config.set({
});
};
I installed the karma-jasmine by npm, the only thing I would mentioned is all the bower_components arein the app directory by yeoman grunt configuration. If I put all the bower_components on the root directory of the project with bower.json (since in the yeoman generator it use .bowerrc file to redirect the install directory to app/bower_components which I would like to keep), then the test will work. So the only difference is the bower_components place. I have a guess with npm package place which is also under the root directory, would it be the case? But anyway I want to ask for a good solution for that, since I think the directory structure of yeoman workflow is quite good way to start :)
PS: I am using jasmine-jquery 2.0.0 and karma-jasmine 0.1.5
The text was updated successfully, but these errors were encountered: