Patrick Reck Patrick Reck - 4 months ago 102
AngularJS Question

Karma + ui-router fails: Cannot read property 'isDefined' of undefined

I am using

ui-router
in my Angular project. For testing, I am using
Karma
and
Jasmine
.

When running
Karma
, I am getting the following error:

Uncaught TypeError: Cannot read property 'isDefined' of undefined
at /Applications/MAMP/htdocs/examtesting/js/vendor/angular-ui-router.min.js:7


How do I get past this?

Here's the whole terminal:

patrickreck@Patricks-MacBook-Pro /A/M/h/examtesting> karma start karma.conf.js
INFO [karma]: Karma v0.12.16 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 35.0.1916 (Mac OS X 10.9.2)]: Connected on socket xtivwYEP-4sBQAeAlsMl with id 73870853
Chrome 35.0.1916 (Mac OS X 10.9.2) ERROR
Uncaught TypeError: Cannot read property 'isDefined' of undefined
at /Applications/MAMP/htdocs/examtesting/js/vendor/angular-ui-router.min.js:7

Answer

isDefined could possibly be a property of the angular variable. So maybe the angular library is not being loaded properly.

Can you post the Karma config file? Angular needs to be loaded before angular-ui-router.js.