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

Compare to Service Mocker #65

Closed
kettanaito opened this issue Mar 13, 2020 · 2 comments
Closed

Compare to Service Mocker #65

kettanaito opened this issue Mar 13, 2020 · 2 comments
Labels
good first issue Good for newcomers

Comments

@kettanaito
Copy link
Member

kettanaito commented Mar 13, 2020

There is a Service Mocker library that also utilizes Service Workers for the purpose of API mocking. I'd like to introduce a comparison section to the MSW documentation that highlights the difference between two libraries, helping developers to choose what suits them best.

Please, if you are an active user of Service Mocker feel free to provide suggestions or edits to the comparison table below.

Comparison

Setup

Service Mocker MSW
Has client and server parts. Has only client part.
Seems like requires to set Service-Worker-Allowed header to register a worker on a path different than root. Requires to place the worker file in the public dir of your app.

I'd say that you need less setup code to start with MSW, making the adoption process faster. The substantial flaw is that MSW requires to place the mockServiceWorker.js in your public directory.

Workflow

Service Mocker MSW
Adopts Express API in its entirety. Seamless usage for Express users. Adopts Express API partially. Favors functional composition. Has custom ctx utilities for more efficient mocking.

Internals

MSW

Client -- request --> ServiceWorker -- serialize --> Client (MSW) -- get response from schema --> ServiceWorker --> `respondWith()`
@kettanaito
Copy link
Member Author

I've tried to put up the first difference I spotted when reading the docs. I have not actually used Service Mocker, so my conclusion may be incomplete or irrelevant. I'll try to use that library and update this comparison with more objective points.

@kettanaito kettanaito added the good first issue Good for newcomers label Apr 24, 2020
@kettanaito
Copy link
Member Author

I've performed a comparison between the two solutions and will publish it as a part of updated website and docs. Closing this to prevent confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant