Skip to content

How to mock third-party resources loaded in the <head>? Wait for the worker to start before document request? #463

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

You must be logged in to vote

Yeah, I think this is just one of those limitations of service workers. Handler updates don't require worker updates so you are free to edit your mocking logic and have no race conditions again after the worker has registered the first time. The worker only ever needs to re-register when the worker script itself changes (e.g. you update MSW).

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@silvenon
Comment options

silvenon Apr 14, 2025
Author Sponsor

@kettanaito
Comment options

@silvenon
Comment options

silvenon Apr 15, 2025
Author Sponsor

@kettanaito
Comment options

Answer selected by silvenon
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