Skip to content
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

support FakeXMLHttpRequest response property #280

Merged
merged 1 commit into from
Nov 28, 2019

Conversation

kellyselden
Copy link
Contributor

re pretenderjs/FakeXMLHttpRequest#53

These 2 PRs fixed the problem for me ember-vr/ember-vr-shopping#192

package.json Outdated
@@ -48,7 +48,7 @@
"typescript-eslint-parser": "^21.0.2"
},
"dependencies": {
"fake-xml-http-request": "^2.0.0",
"fake-xml-http-request": "kellyselden/FakeXMLHttpRequest#response",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this package used in test is from bower.
https://github.com/pretenderjs/pretender/blob/v3.0.4/karma.conf.js#L18

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just merged #281. Can you try rebase?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's github artifact cache didn't update. I just tried v2.1.1 and it passed tests.

@kellyselden
Copy link
Contributor Author

Do you happen to see where I went wrong in the tests or code?

@xg-wang
Copy link
Member

xg-wang commented Nov 17, 2019

@kellyselden It seems the changes in src/fake-xml-http-request.js should also be made to fake-xml-http-request.js under root, that is the file used for testing

'node_modules/fake-xml-http-request/fake_xml_http_request.js',

@kellyselden
Copy link
Contributor Author

@xg-wang Good call. I did that, and it appears the same issue remains.

@kellyselden
Copy link
Contributor Author

Updated with 2.1.1 and all is good now.

@xg-wang xg-wang merged commit 2c8375f into pretenderjs:master Nov 28, 2019
zburke added a commit to zburke/pretender that referenced this pull request Dec 3, 2019
fake-xml-http-request v2.1.1 introduced breaking changes to the handling
of the `response` property. In previous releases, `response` was not always
present, allowing fake-xml-http-response to interact with libraries such as
[whatwg-fetch](https://github.com/github/fetch/blob/96b37eb63ef8f2644f985cd77e7bd87b04e61ad4/fetch.js#L462)
that make decisions based on that behavior. Because pretender has a
caret dep on fake-xml-http-request, that change effectively broke
the previous major release (v2.x) of pretender because the PR pretenderjs#280 is
only available on the current major release (v3.x).

This PR simply changes the dependency on fake-xml-http-request from a
caret `^` to a tilde `~` in order to prevent that breaking change from
leaking through. If merged to a branch split from the last v2 commit and
released as v2.1.2, it would restore the previous behavior without
having any effect on the current major release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants