You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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()`
The text was updated successfully, but these errors were encountered:
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.
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.
Comparison
Setup
client
andserver
parts.client
part.Service-Worker-Allowed
header to register a worker on a path different than root.Workflow
ctx
utilities for more efficient mocking.Internals
MSW
The text was updated successfully, but these errors were encountered: