forked from mswjs/msw
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Draft: Add node v18 support with tests (WIP): use patched @mswjs/interceptors
#2
Open
milesrichardson
wants to merge
12
commits into
main
Choose a base branch
from
intercept-node-v18-native-fetch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tarball with patched version of this PR: https://github.com/milesforks/msw/blob/released/patched/intercept-node-v18-native-fetch/unreleased-msw-1190f5560178babd232abbb9a96ce8ba4f1abfb1.tgz?raw=true (generated from 4ded61d on Sep 29) |
milesrichardson
changed the title
Add node v18 support with tests (WIP): use patched
Draft: Add node v18 support with tests (WIP): use patched Aug 31, 2022
@mswjs/interceptors
@mswjs/interceptors
milesrichardson
force-pushed
the
intercept-node-v18-native-fetch
branch
from
September 1, 2022 05:06
89a4902
to
3e5df40
Compare
milesrichardson
force-pushed
the
intercept-node-v18-native-fetch
branch
2 times, most recently
from
September 2, 2022 04:56
8076ddf
to
f445fc1
Compare
4 tasks
…rver This actually seems to work fine, even without any tests or changes necessary. However, for tests to pass with Node v18 and also I think to support some https cases, the PR from mswjs/interceptors should be merged: mswjs/interceptors#283
- Point `@mswjs/interceptors` to a tarball that was built from the code in this pending PR: milesforks/msw-interceptors#5 Using commit: milesforks/msw-interceptors@25a8ffa
…terface * Upgrade to the latest available version of `@open-draft/test-server`, which replaces `async createServer()` closure factory with `new HttpServer()` and `async HttpServer.prototype.listen()`. That is, previously we awaited a single function to create the server and start listening, but now we create the server with a synchronous function and await its listener separately. * Also (in a rebased version of this commit), upgrade to yet another version of `@open-draft/test-server` which fixes URL serialization of IPv6 hosts * Change all affected tests to use this new instantiation method
This fixes a bug in tests where the preview server is bound to an IPv6 URL, which causes the matcher to fail when comparing the URL to origin, which causes the request to send wthout a `referer` header, which causes an error in the service worker and incorrect error snapshots (e.g. using full URL instead of relative URL because no match was found). Fix: * When escaping colons in path before passing to `path-to-regexp`, make sure to include colons in the host, but only if it's a bracketed IPv6 host (this means that you can use wildcards in a non-bracketed host if you really want to, e.g. `:subdomain.foo.com`) * Combine previously multiple regexes for scheme and port into a single regex for scheme, port, and host (since their logic is interdependent) * Add tests for various convoluted IPv6 scenarios and wildcard placements
It's useful to run tests in debug mode because it opens a live ("headful") Playwright browser, e.g. `DEBUG=1 yarn test:integration passthrough` will run the `passthrough.test.ts` tests in a headful Chromium instance However, the live debug browser behaves slightly differently from the headless browser, because there is a navigation request to the page where the service worker has already been loaded, which causes the service worker to intercept the initial navigation request. This is a dangerous trap if you're trying to fix a test by running it in debug mode. If this is detected, print a friendly warning to the developer to hopefully save them some time.
… `waitForResponse` Fix a bug where `waitForRequest` and `waitForResponse` would hang and never match a request when the URL is an IPv6 URL
milesrichardson
force-pushed
the
intercept-node-v18-native-fetch
branch
from
September 29, 2022 02:15
5e9a2f9
to
4ded61d
Compare
milesrichardson
added a commit
to splitgraph/madatdata
that referenced
this pull request
Sep 29, 2022
Use the package built temporarily as a tarball from pending/WIP PR at milesforks/msw#2
milesrichardson
force-pushed
the
intercept-node-v18-native-fetch
branch
from
September 29, 2022 20:21
1bc2011
to
fd3246d
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is based on #1 but assumes that mswjs/interceptors#283 has been merged. Currently it points to a tarball built from the code in that PR.