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

How to use MSW? #13

Open
NullVoxPopuli opened this issue Jun 4, 2022 · 2 comments
Open

How to use MSW? #13

NullVoxPopuli opened this issue Jun 4, 2022 · 2 comments

Comments

@NullVoxPopuli
Copy link

This may be a bit divisive, but until mirage uses msw for request mocking (or at least stops using pretender), I don't think we should encourage mirage's usage.

MSW is super easy to setup, and they have their own data library, too: https://github.com/mswjs/data

Here is an 8 commit tutorial for setting up MSW: https://github.com/NullVoxPopuli/ember-msw-development/commits/main

@acorncom
Copy link
Member

acorncom commented Jul 4, 2022

@NullVoxPopuli is there a specific reason you dislike pretender? Curious what it is about msw you find is preferable to pretender

@NullVoxPopuli
Copy link
Author

  • MSW is bigger, more people looking at it improving it, whereas pretender is stagnant: https://npmtrends.com/msw-vs-pretender
    (And i wouldn't consider pretender complete)
  • MSW supports graphql
  • with MSW, you dubug requests as if you didn't have mocking set up at all, in the Browser's network inspector (worlds better than pretender's logging)
  • MSW's data doesn't count against your build time because mocks and all that are 'just in the public folder' (though, you can still define in-bundle mocks for tests and stuff)
  • MSW doesn't patch globals, intercepts all requests if you want (the primary advantage of living in a service worker)
  • MSW also works in node

More info: https://github.com/mswjs/msw

This comparison here may be helpful
https://mswjs.io/docs/comparison

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

No branches or pull requests

2 participants