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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore
style.loadURL
abort error when style is removed #4425Ignore
style.loadURL
abort error when style is removed #4425Changes from 6 commits
7a76428
2c6ca9b
8347859
22d0d98
f6e7764
474296a
ab2007f
fc3cc98
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see other places are using a simpler method:
expect((server.lastRequest as any).aborted).toBe(true);
I think it can be used here as well.
I'll open a PR to update the types so we can remove these "as any".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect((server.lastRequest as any).aborted).toBe(true);
is used to test if the request has been aborted, which the test above does ('cancels pending requests if removed'
). In our case, we want to test that, when the request is aborted, no error are fired.Removing these "as any" would be nice, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
expect((server.lastRequest as any).aborted).toBe(true);
would remove the need to use this promise, and wait for it rejection. I find it more elegant. You might still need asleep(0)
though.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the nise types, now you can use it without the "as any":
#4446
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks !
We would still need a
sleep(0)
since the rejection is asynchronous. Without it, the test succeed even if the Style fires the abort error. The promise is just a way to wait for the rejection we want to test rather than just wait for a bit with thesleep(0)
, but I agree it's not very elegant and it might be too bound to implementation. Should I revert tosleep(0)
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please.