I am brand new to jasmine and karma. I believe I have the environment setup properly and I am able to run very basic unit tests, but as soon as I try to instantiate a controlle
You'll get this error if one of the injectables module isn't included.
For instance, you have
beforeEach(module('home'));
If your $state
dependency is not in the home
module, you'll need to include that module also. I'm not familiar with $state
(I think it's angular-ui's router? Only angular.js services are supposed to start with $
). If it's angular ui, this is how you should setup:
beforeEach(module('ui.router'));
beforeEach(module('home'));
This way, angular's test runner knows what modules are required to run your tests.
Really, the inclusion of the home
module should do this for you as long as you have the ui.router
dependency defined as a dependency of that module. If you have that configured correctly, you may need to look at the order of your files being included for your tests. For example, make sure the ui-router file is being included for your tests and that it is referenced before your home
module in karma's config.