I am trying to setup my karma tests but am having a problem getting my test to run. I have my test written like this
describe("Test Controller", function() {
beforeEach(module('thisApp'));
var $controller;
var x = 1;
beforeEach(inject(function(_$controller_) {
$controller = _$controller_;
}));
it('should work', function() {
expect(x).toEqual(1);
});
});
but I'm getting an error
Test Controller should work FAILED
.../node_modules/angular/angular.js:4631:53
forEach@/Users/.../node_modules/angular/angular.js:322:24
loadModules@/Users/.../node_modules/angular/angular.js:4591:12
createInjector@/Users/.../node_modules/angular/angular.js:4513:30
workFn@/Users/.../node_modules/angular-mocks/angular-mocks.js:3067:60
my conf file is including these files
files: [
'node_modules/angular/angular.js',
'node_modules/angular-mocks/angular-mocks.js',
'app/app.js',
'app/controllers/*.js',
'app/test/unit/*.spec.js'
],
If I remove the beforeEach(inject...) then my test will run and says success but it gives me that error when I include it.
What am I missing?
Aucun commentaire:
Enregistrer un commentaire