Assert "mockServiceWorker" integrity
See original GitHub issueMotivation
The library must assert the integrity of the mockServiceWorker.js
file for multiple reasons:
- Ensure the file is up-to-date, as it lives in the user’s public directory and is not updated during new installations of
msw
package - Ensure the file is actually a valid MSW file, to prevent malware masking as MSW
Implementation
Publication
- Minimize
- Remove comments
- Generate a checksum out of the
mockServiceWorker.js
file content
Client-side
- Signal to Service Worker upon
start()
invocation to get the integrity information. - Assert the integrity on the client-side.
- Display an error in case integrity fails. Suggest to run
npx init <PUBLIC_DIR>
to resolve the issue.
Issue Analytics
- State:
- Created 3 years ago
- Comments:18 (18 by maintainers)
Top Results From Across the Web
Request assertions - Recipes - Mock Service Worker Docs
Include any necessary validation and utilize conditional mocking to reflect a request's integrity in your response resolvers.
Read more >Mock Service Worker - mockServiceWorker not listening ...
I have tried to running mockserviceworker in angular prod and dev build . i have kept debugger in self.addEventListener('message') , compiler ...
Read more >When should I (not) use mocks in testing? - DEV Community
To assert a list of user's purchases you can mock the user already being authenticated, instead of going through the authentication in the ......
Read more >A Comprehensive Guide to Mock Service Worker (MSW)
Discover our comprehensive guide to Mock Service Worker (MSW) and use the API mocking tool for testing, development, debugging to deliver ...
Read more >Want to increase your quality and reduce your deployment ...
However, if you use Mock Service Worker to mock the endpoints, ... Mock Service Worker, render the app, and write out the assertions...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Excellent. Thank you!
Oh, I was confused. So it’s not likely that there would be a problem because that file doesn’t get updates very often.
I think that’s ok. Sorry for my misunderstanding, thank you for taking the time to explain it to me.