You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
I'm trying to figure out how to mock out a service. This is what I'm trying:
'use strict';varexpect=chai.expect;beforeEach(module('myModule'));angular.module('mocks',[]).factory('getPageName',function(){returnfunction(){return"foo";}});describe('Foo',function(){it('should not crash',function(){module('mocks');});});
Is it supposed to work? I get the following error:
Chrome 23.0 (Mac) Foo should not crash FAILED
TypeError: Cannot read property 'running' of undefined
at isSpecRunning (path/lib/angular/angular-mocks.js:1626:44)
at window.module.angular.mock.module (path/lib/angular/angular-mocks.js:1648:12)
at Context.<anonymous> (path/test/unit/directives/disclaimer.js:17:9)
I don't want to put the module() call in a beforeEach() because some tests need the mocks and others don't.