-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Updated #2318 - Use raynos/xhr - rebased and fixed test errors #2594
Conversation
* }); | ||
* | ||
* Check out the [full | ||
* documentation](https://github.com/Raynos/xhr/blob/master/README.md) |
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.
https://github.com/Raynos/xhr/blob/v2.1.0/README.md would be safer but not a huge issue.
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.
Good call
|
Thanks! |
- Get rid of our custom XHR shim. Export it as videojs.xhr. - Updated XHR to be stubbed everywhere in tests to prevent errors. - Added npm install to the review process closes videojs#2318 closes videojs#2594
b28ab03
to
24cdbde
Compare
In xhr 2.0+ (and sone earlier versions) there are multiple ways you can stub or replace Anyway, I'm glad to see more adoption :) |
Thanks for the note @naugtur (and for the help in getting this done!). It looked like the other ways to stub xhr required us to change the app code to allow passing an xhr object in. That didn't seem ideal, and the global stub is actually kind of nice because it removes the issue from any future tests. If there's other ways to stub that I'm missing though I'd be interested to know. |
I'd suggest using the other option from the docs (at the end of README.md) and doing just xhr.XMLHttpRequest = MockXMLHttpRequest Whenever you do that, from then on, |
Ah great! Missed that option. Thanks! |
closes #2318
The only major change from #2318 is I moved sinon XHR stubbing to the cover all tests, because with raynos/xhr we have to stub it before the xhr module is ever loaded.