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.
ngMock window.inject doesn't return value from function #13584
Open
Description
I'd like to use lazy vars interface for mocha.js (https://github.com/stalniy/bdd-lazy-var) and write like this
describe('My Controller', function() {
def('scope', inject(function($rootScope) {
return $rootScope.$new();
}));
it(...)
})
This doesn't work as inject
doesn't return the value from function which it wraps. I checked the source code and I see that inject
able to inject services into functions which are passed as multiple arguments.
That's a pretty rare case from my point of view. But in order to leave backward compatibility we can store returting values and if passed only 1 function return the value returning by injector.invoke(....)
Let me know if you are ok with this fix! If so, I will create pull-request