Skip to content

Can I use this to test my own service worker implementation? #683

Answered by kettanaito
dethstrobe asked this question in Q&A
Discussion options

You must be logged in to vote

Hey, @dethstrobe.

I don't think you should use MSW to test a custom Service Worker. MSW uses a Service Worker to intercept HTTP requests and then give you control over their responses. The worker is treated as an implementation detail. The library doesn't expose any means to test a worker.

I think you may be looking for something like service-worker-mock (pardon the naming confusion). I haven't used that package, but it seems to be designed for testing workers, which is what you're after.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kettanaito
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants