This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
angular-mock: $animate.flush is not a function #14668
Closed
Description
In my Mocha tests run with Karma, I have to flush some animation before making some assertions:
beforeEach(inject(function ($animate, $httpBackend) {
$httpBackend.flush();
$animate.flush();
scope.$digest();
}));
I get the following error: $animate.flush is not a function
. Other mocks work well ($httpBackend for instance).
I searched a bit and saw that the part of the code of angular-mock that defines the $animate service is never executed. I also saw that mocked $animate is the only mock that is declared as an actual module and this module is never required.
I can get my tests working by adding following line here: modules.unshift('ngAnimateMock');
Environment info:
Angular: 1.5.5
Mocha: 2.2.1
Karma: 0.13.10
Is this a bug or am I missing something? Thanks in advance