Karan Karan - 1 year ago 222
jQuery Question

Karma: Uncaught ReferenceError: jQuery is not defined

I am running Karma on my yeoman based angularjs app.

I get the following error when running "grunt karma":

Chrome 28.0 (Mac) ERROR
Uncaught ReferenceError: jQuery is not defined
at myNgApp/admin/app/scripts/bootstrap.min.js:6
Chrome 28.0 (Mac): Executed 0 of 0 ERROR (0.206 secs / 0 secs)

When I launch the app on my browser via "grunt server", everything seems fine. There are no errors on the console either.

also imports
before any other JavaScript file. Any idea what is going on?

Update: I have a feeling the the command
grunt karma
is looking through all the files in my scripts directory. Bootstrap is one of the first ones, and it probably loads that before jQuery, and hence the error.

If this is the case, how do I stop this?

Answer Source

Did you load jQuery in the karma.conf.js?

This is how my list looks:

// list of files / patterns to load in the browser
files: [
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download