This repository was archived by the owner on Feb 26, 2024. It is now read-only.
feat(spec): log URL in error when attempting XHR from FakeAsyncTestZone#893
Merged
mhevery merged 1 commit intoangular:masterfrom Sep 6, 2017
Merged
feat(spec): log URL in error when attempting XHR from FakeAsyncTestZone#893mhevery merged 1 commit intoangular:masterfrom
mhevery merged 1 commit intoangular:masterfrom
Conversation
Save the URL from xhr.open and log it when throwing an error from FakeAsyncTestZone when the XHR send it attempted. This would make it easier to debug such errors from a fakeAsync test.
JiaLiPassion
reviewed
Sep 6, 2017
| throw new Error('Cannot make XHRs from within a fake async test.'); | ||
| throw new Error( | ||
| 'Cannot make XHRs from within a fake async test. Request URL: ' + | ||
| (task.data as any)['url']); |
Collaborator
There was a problem hiding this comment.
@vikerman , if we get the url from task.data, maybe we can get the url by directly calling 'task.data.target.responseURL? So we don't need to save an additional urlinxhrandtask.data`
Contributor
Author
There was a problem hiding this comment.
From my testing responseURL is an empty string before the actual request is sent.
juliemr
approved these changes
Sep 6, 2017
Member
juliemr
left a comment
There was a problem hiding this comment.
Yay! This'll help debugging tons.
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.
Save the URL from xhr.open and log it when throwing an error from FakeAsyncTestZone when the XHR send it attempted. This would make it easier to debug such errors from a fakeAsync test.