I'm having issues with ngMocks
and the $log
provider that is mocked in there.
Anytime a use $log
in my code, the tests fails, because of the mock for $log
fail at (line 295):
var $log = {
log: function() { $log.log.logs.push(concat([], arguments, 0)); },
warn: function() { $log.warn.logs.push(concat([], arguments, 0)); },
info: function() { $log.info.logs.push(concat([], arguments, 0)); },
error: function() { $log.error.logs.push(concat([], arguments, 0)); },
debug: function() {
if (debug) {
$log.debug.logs.push(concat([], arguments, 0));
}
}
};
as $log.info.logs
looks to be undefined and not an array.
I've noticed that changing the log function in ngMock
in this way:
info: function() {
$log.info.logs = $log.info.logs || [];
$log.info.logs.push(concat([], arguments, 0));
},
make my test pass.
Any idea on why this can happen? I think it's not a bug in ngMock
as I've not found any reference around.