-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
karma jasmine issue #123
Comments
Ah that's the bug I'm trying to kill before I make a new release, is it possible to have the source causing the trouble? I haven't been able to replicate it so far |
angular.module('test', [
'oc.lazyLoad'
]) angular.module('test')
.config(function($compileProvider, $logProvider, $ocLazyLoadProvider, REQUIRED) {
// angular debugger, false for production
$compileProvider.debugInfoEnabled(true);
// $log debugger, false for production
$logProvider.debugEnabled(false);
// inject httpInterceptor Factory
/*$httpProvider.interceptors.push('httpInterceptorFactory');*/
$ocLazyLoadProvider.config({
debug: false,
events: true,
modules: REQUIRED.modules
});
}) angular.module(test')
.controller('appCtrl', function($scope, dataFactory) {
this.test = 'hello';
$scope.test = 'hello';
dataFactory.user();
}); this is pretty much it. test code, describe('appCtrl main app controller', function() {
var $controller;
beforeEach(module('test', function($provide) {
}));
beforeEach(inject(function(_$controller_) {
$controller = _$controller_;
}));
beforeEach(function() {
window.Routing = jasmine.createSpyObj('Routing', ['generate']);
});
it('controller should be defined', function() {
var $scope = {};
var controller = $controller('appCtrl', {
$scope: $scope
});
expect(controller.test).toBeDefined();
expect($scope.test).toBeDefined();
});
}); Even if you duplicate the same code, throws an error.
|
I had to change your test definition to: beforeEach(function() {
module('test');
inject(function(_$controller_) {
$controller = _$controller_;
})
}); But otherwhise it seems to be working (I don't have all your code so I don't know). Maybe you could give me both tests to check. |
Can you send me your package.json & bower, or is it same as the the repo? |
My tests are very basic really. Errors happen after the second test module init. |
Yes the same as the repo |
Ok, I will give that a shot as well. |
Ok, I tried it your way, and the inject part is throwing error now. Have you tried this with 1.3.10 modules? I will downgrade to your version -1.3.2 now to see if it makes a difference |
So i tried it with your configuration, and it didn't work. As soon as I remove oclazyload, I get success. I will try some other variations. |
Ok! I figured it out. I probably didn't know this to start with. Oclazyload needs to be loaded before angular-mocks in the karma.conf file. |
Oh yes, it makes a lot of sense, I should mention it in the readme. |
Oh not at all, thank you for such a great product. |
I am trying the new master src with karma test runner. for first test, everything was ok. Second test, I am getting an error as soon as the module is initialized with,
The text was updated successfully, but these errors were encountered: