-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Missing angular prefix from isDefined calls in ngMock $interval service #4334
Comments
@mjtko - You are right about this, sort of. If this was in the "real" world then this would crash every time. But the reason it does not fail is that ngMock is only ever loaded up in unit tests. And in this case the unit tests are loaded up in the same global namespace as the ng source, which does indeed define So it is not really a big problem, but to keep consistency then it ought to have |
@petebacondarwin - Ok, I'll knock up a PR, thanks. I'm certainly seeing this fail like this, but perhaps it's the way I have my environment configured. I don't have |
In your tests it will fail. This is why it is wrong. In angular project
|
Ah! Ok, so it is expected to be a problem in the real world for me then! Sorry, I thought you were implying that it should never be a problem - but I now understand that you meant that the problem was not (and cannot) be uncovered by the unit tests of the angular project as Am I on the right track now? (PS. I'll shortly STFU and get a PR written, I just want to be sure I'm understanding correctly! 😉) |
The newly introduced `$interval` mock service for ngMock calls `isDefined` in the global namespace which fails when used within unit tests. This change adds the missing `angular.` prefix to such `isDefined` calls. Closes angular#4334
Right
|
Perfect, thanks for getting back to me. I'm still new to Angular, so I want to be certain that I'm not getting the concepts or my infrastructure wrong! |
The newly introduced `$interval` mock service for ngMock calls `isDefined` in the global namespace which fails when used within unit tests. This change adds the missing `angular.` prefix to such `isDefined` calls. Closes angular#4334 Closes angular#4353
The newly introduced `$interval` mock service for ngMock calls `isDefined` in the global namespace which fails when used within unit tests. This change adds the missing `angular.` prefix to such `isDefined` calls. Closes angular#4334 Closes angular#4353
As mentioned in line notes on 2b5ce84, the merge of #4047 introduced two plain calls to an undefined
isDefined
function in ngMock which should be calls toangular.isDefined
instead.2b5ce84#diff-2a255ed5e9564e25ce6eb711b604f40fR470 and 2b5ce84#diff-2a255ed5e9564e25ce6eb711b604f40fR472 are the lines in question.
I would submit a PR, but I don't want my first-time contribution to Angular to be spec-less, and I'm at a loss as to how to go about providing failing tests (or indeed, any tests!) in this particular instance. Let me know if you want me to knock up a PR anyway (though I'm sure somebody from the Angular team can handle this more rapidly than that :-)).
The text was updated successfully, but these errors were encountered: