-
Notifications
You must be signed in to change notification settings - Fork 27.4k
ngMock window.inject() does not add inject() call location info to errors thrown from repeated inject() callback calls #13594
Comments
…vocations Failed injection functions should consistently include their respective window.inject() call location information in their stack trace, even on repeated invocations & when they have been passed as a non-initial parameter to their window.inject() call. Closes angular#13594.
… functions Injection function throwing an Error should update the thrown Error's stack trace information with the window.inject() call location information even when multiple injection functions are passed to the window.inject() call and non-initial provided function fails. Closes angular#13594.
… functions Injection function throwing an Error should update the thrown Error's stack trace information with the window.inject() call location information even when multiple injection functions are passed to the window.inject() call and non-initial provided function fails. Closes angular#13594.
… functions Injection function throwing an Error should update the thrown Error's stack trace information with the window.inject() call location information even when multiple injection functions are passed to the window.inject() call and non-initial provided function fails. Closes angular#13594.
… functions Injection function throwing an Error should update the thrown Error's stack trace information with the window.inject() call location information even when multiple injection functions are passed to the window.inject() call and non-initial provided function fails. Closes angular#13594.
ping? |
Thanks for raising this issue. It's not super high priority, so we'll look into it when we have the time. |
Heh, yeah... but clear pull requests #13597 & #13598 have been prepared resolving it so I don't think officially fixing this issue should take much time. And most of the changes in the pull requests are just added tests for previously completely untested part of the code-base. 😄 Kind of a low hanging fruit at the moment while, as the time goes by, the pull requests will just naturally collect conflicts. There are actually two separate issues touching the same part of the code-base here - #13591 & this one - #13594. The pull requests for #13591 need to be applied first, as the pull requests for this issue build on those, adding to the same part of the test suite. And I think all the pull requests should be real easy to review + merge.:smile: Please let me know if there is anything else I can do to get this merged. Many thanks, |
… functions Injection function throwing an Error should update the thrown Error's stack trace information with the window.inject() call location information even when multiple injection functions are passed to the window.inject() call and non-initial provided function fails. Closes angular#13594.
… functions Injection function throwing an Error should update the thrown Error's stack trace information with the window.inject() call location information even when multiple injection functions are passed to the window.inject() call and non-initial provided function fails. Closes angular#13594.
… functions Injection function throwing an Error should update the thrown Error's stack trace information with the window.inject() call location information even when multiple injection functions are passed to the window.inject() call and non-initial provided function fails. Closes angular#13594.
… functions Injection function throwing an Error should update the thrown Error's stack trace information with the window.inject() call location information even when multiple injection functions are passed to the window.inject() call and non-initial provided function fails. Closes angular#13594.
… functions Injection function throwing an Error should update the thrown Error's stack trace information with the window.inject() call location information even when multiple injection functions are passed to the window.inject() call and non-initial provided function fails. Closes angular#13594.
Looks like the PRs have been merged! |
Oh no, the other one has been merged ... |
Overview of the Issue
ngMock
window.inject()
function has some seemingly quick-fix functionality adding thewindow.inject()
call location stack trace information to any errors thrown by the callback passed to thewindow.inject()
call. This however has a bug in that it only adds this information to errors thrown from the first callback invocation, but not for any later ones, while there are typical scenarios when a callback given to it may be invoked multiple times during a single test run.Motivation for or Use Case
Here's a typical scenario where a callback passed to
ngMock
'swindow.inject()
function gets called multiple times in a single test suite:Here the first test spec's error information will include the
window.inject()
call location stack trace information, while the second test spec's will not. And if for some reason only the second test spec throws an error, then nowindow.inject()
call location stack trace information will be reported back to the user at all.Angular Version(s)
1.4.8
&master
versionsBrowsers and Operating System
Ubuntu 15.10
, but should not be OS specificReproduce the Error
Just run the use case presented in the Motivation for or Use Case section above.
Suggest a Fix
errorForStack
information after the first call to thewindow.inject()
callbackThe text was updated successfully, but these errors were encountered: