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 Pretender 2 #1392

Merged
merged 1 commit into from
Oct 10, 2018
Merged

Support Pretender 2 #1392

merged 1 commit into from
Oct 10, 2018

Conversation

jherdman
Copy link
Contributor

@jherdman jherdman commented Oct 9, 2018

This change does not, like originally intended, make Pretender a peer
dependency. There's a lot of work and debate being done here, so in the
mean time let's unlock fetch support in Mirage.

Dependency changes

  • pretender 1.6 => 2.1. I've locked at 2.1.0 until
    Switch back to whatwg-fetch pretenderjs/pretender#235 is resolved. This will require code changes
    on our end, and thus I don't want this sliding from underneath us and
    causing unnecessary weeping and gnashing of teeth.
  • Add xg-wang/whatwg-fetch. Required for the upgrade.
  • fake-xml-http-request 1.4.0 => 2.0.0. Required for the upgrade.
  • route-recognizer 0.2.3 => 0.3.4. Required for the upgrade.
  • ember-cli-node-assets 0.1.4 => 0.2.2. Because why not! I'm kneed deep
    in this stuff, so I may as well keep this up to date.

This change does not, like originally intended, make Pretender a peer
dependency. There's a lot of work and debate being done here, so in the
mean time let's unlock `fetch` support in Mirage.

Dependency changes
------------------

* pretender 1.6 => 2.1. I've locked at 2.1.0 until
  pretenderjs/pretender#235 is resolved. This will require code changes
  on our end, and thus I don't want this sliding from underneath us and
  causing unnecessary weeping and gnashing of teeth.
* Add xg-wang/whatwg-fetch. Required for the upgrade.
* fake-xml-http-request 1.4.0 => 2.0.0. Required for the upgrade.
* route-recognizer 0.2.3 => 0.3.4. Required for the upgrade.
* ember-cli-node-assets 0.1.4 => 0.2.2. Because why not! I'm kneed deep
  in this stuff, so I may as well keep this up to date.
@@ -144,15 +154,24 @@ module.exports = {
}
};

function npmAsset(filePath) {
function npmAsset(options = {}) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactoring here required to silence a source maps warning for route-recognizer.

@jherdman
Copy link
Contributor Author

jherdman commented Oct 9, 2018

I'm fairly sure this works. I still need to smoke test this on a few apps of mine. I'm especially keen on ensuring that fetch support works.

I think we can remove the Pretender shim too, but I haven't verified this yet. Theoretically Pretender provides such a shim now.

"broccoli-stew": "^1.5.0",
"broccoli-string-replace": "^0.1.2",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was moved around when installing the various dependencies.

@jherdman jherdman mentioned this pull request Oct 9, 2018
2 tasks
@jherdman
Copy link
Contributor Author

jherdman commented Oct 9, 2018

Smoke test done, and I can report gold!

@samselikoff
Copy link
Collaborator

Sick!!

Was busy earlier this week, I know you pinged me about helping out. Sorry for being radio silent, and thank you so much James!

@samselikoff samselikoff merged commit b0fd939 into miragejs:master Oct 10, 2018
@jherdman jherdman mentioned this pull request Oct 10, 2018
10 tasks
@mydea
Copy link

mydea commented Nov 23, 2018

Any chance of getting a release with this change? Would be awesome!

@samselikoff samselikoff mentioned this pull request Feb 4, 2019
@bjornharrtell
Copy link
Contributor

This seems to be released since quite some time but fetch via mirage passthrough still doesn't work for me, getting Unexpected end of JSON input when parsing the response.

@bjornharrtell
Copy link
Contributor

Got it to work after all because it seems my problem was caused by the issue fixed by pretenderjs/pretender#280. Had to override pretender transitive dependency.

@samselikoff
Copy link
Collaborator

@bjornharrtell yikes, sounds bad. So you're saying ember-cli-mirage wasn't intercepting fetch requests?

@bjornharrtell
Copy link
Contributor

@samselikoff yep, afraid so.

@samselikoff
Copy link
Collaborator

Any chance you could provide a reproduction?

@jherdman jherdman deleted the pretender-2 branch December 15, 2019 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants