-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fix(browser): allow service workers to mock the network in chromium without breaking vi.mock #8668
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
fix(browser): allow service workers to mock the network in chromium without breaking vi.mock #8668
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
|
||
| // Enable intercepting of requests made by service workers - experimental API is only available in Chromium based browsers | ||
| // Requests from service workers are only available on context.route() https://playwright.dev/docs/service-workers-experimental | ||
| process.env.PW_EXPERIMENTAL_SERVICE_WORKER_NETWORK_EVENTS = '1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should do ??= to allow user-override
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, because the docs say this
Set the PW_EXPERIMENTAL_SERVICE_WORKER_NETWORK_EVENTS environment variable to 1 (or any other value) to enable the feature. Only Chrome/Chromium are currently supported.
it's unclear to me if user setting '' will work but no harm in this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sheremet-va what Is needed to progress this pr? I saw some of the checks failed but I'm not sure they are caused by my change, hard to tell
…Georgegriff/vitest into fix-service-worker-traffic-interception
|
Thanks! |
…ithout breaking vi.mock (#8668) Co-authored-by: Vladimir <[email protected]>
|
@sheremet-va good news as of playwright 1.57 ( |
Description
Fix for mswjs/msw#2589
Fixes #8473
Fixes #8410
Fixes the use of service workers (msw) to mock APIs in playwright
Things to note
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.