This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Fix ngMock window.inject() error stack trace reporting on repeated or non-initial injection function calls for the 1.4.x branch (issue #13594)#13597
Open
jurko-gospodnetic wants to merge 7 commits into
Conversation
ac9dab3 to
4c5918e
Compare
This was referenced Dec 20, 2015
4c5918e to
0ce25ca
Compare
0ce25ca to
e0aafea
Compare
Split up `ngMock` `window.inject` tests into tests on browsers supporting fetching current stack trace information and those not supporting it, as we plan on adding new test specs to the first group. Required making the test inject caller function more flexible so it can be easily configured in different tests without unnecessary code duplication.
…ment The results of this function, when called outside of a specific test spec context, should not be reused in multiple tests as they may have stored state that can cause unwanted test spec interaction. This explains why we may need to wrap some tests into their own separate test suites instead of grouping them all under a single shared one.
…apper usage Explicitly commented on why we use an extra function wrapper around the test inject Error throwing code, and how not using it would make our tests give us false positives on certain browsers, e.g. Firefox.
…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.
…alls Injection function throwing an Error should update the thrown Error's stack trace information with the window.inject() call location information, on its initial as well as repeated invocations.
… 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.
e0aafea to
e1e3274
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes & adds tests for issue #13594 for the angular
1.4.xbranch.Does the same work as pull request #13598 does on the angular
masterbranch.window.inject()function updates stack trace information forErrorobjects thrown from injection functions passed to it with stack trace for thewindow.inject()calling location. However this functionality was broken and did not work correctly in the following cases:window.inject()call and a non-initial one throws anErrorThis pull request actually builds on and thus includes pull request #13592, as newly added test specs are integrated into the test structure set up by the base pull request. That's why you should first review & merge that pull request, or ignore its commits when reviewing this one.