When I run the SpecRunner HTML file I get this error.
Looking around, this is due to angular-mocks.js
not being referenced. In my case it is being referenced.
SpecRunner.html:
<link rel="stylesheet" type="text/css" href="lib/jasmine-1.3.1/jasmine.css">
<script type="text/javascript" src="lib/jasmine-1.3.1/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-1.3.1/jasmine-html.js"></script>
<script type="text/javascript" src="lib/angular-mocks.js"></script>
<!-- include source files here... -->
<script type="text/javascript" src="../main/static/js/controllers/norm-definitions-controller.js"></script>
When the tests are run, I get this exception: ReferenceError: inject is not defined
I can see that angular-mocks.js
is referenced and it's not a caching issue as I can see it using Firebug.
Looking in angular-mocks.js
I can see the full reference angular.mock.inject = function() { ... }
, I've tried this as a reference too, and get the exception ReferenceError: angular is not defined
.
You still need angular.js
lib. I didn't saw it among your scripts. It should be before angular-mock.js
.
For the errors which come while adding karma and jasmine to testing your project, make sure that
The above steps help avoid most of the common errors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With