Skip to content
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

Feat/ws sync handlers #2028

Open
wants to merge 223 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
223 commits
Select commit Hold shift + click to select a range
ded1309
feat: wip new api
kettanaito Oct 7, 2022
6a21d47
feat: add "HttpResponse"
kettanaito Oct 8, 2022
90dd65e
feat: support "HttpResponse.arrayBuffer()"
kettanaito Oct 8, 2022
49369e6
fix(HttpResponse): forward cookies in the browser only
kettanaito Oct 8, 2022
3b947c7
docs: update readme
kettanaito Oct 8, 2022
b909e48
fix(pruneGetRequestBody): support HEAD requests
kettanaito Oct 9, 2022
f9840b7
chore: polyfill Request in jest tests
kettanaito Oct 9, 2022
b87724d
feat: support "bypass" utility
kettanaito Oct 9, 2022
3315cd4
chore: update "headers-polyfill" to 3.1.2
kettanaito Oct 9, 2022
aef1db1
test(headers-multiple): separate headers by comma
kettanaito Oct 9, 2022
b44a993
feat: support new api for graphql
kettanaito Oct 9, 2022
71753c3
chore: migrate "msw-api" tests
kettanaito Oct 10, 2022
a5a91dc
feat: add "delay()"
kettanaito Oct 10, 2022
0ee92d8
feat: migrate to new interceptors
kettanaito Oct 14, 2022
7fcadf2
fix(RequestHandler): clone response in generator
kettanaito Oct 14, 2022
d64713a
chore: migrate to fetch api in node
kettanaito Oct 14, 2022
fd89534
feat: export universal fetch classes
kettanaito Oct 14, 2022
5166b5e
fix(bypass): use compatible Request type
kettanaito Oct 15, 2022
11fa7c6
feat: support one-time request handlers
kettanaito Oct 15, 2022
adab915
feat: add "passthrough", fix tests
kettanaito Oct 15, 2022
dde933b
feat: support multi-value response cookies
kettanaito Oct 16, 2022
13bb61f
chore: add "File" polyfill for node
kettanaito Oct 16, 2022
ca158f3
feat: add "HttpResponse.formData()"
kettanaito Oct 16, 2022
e494683
test: fix request FormData body test
kettanaito Oct 16, 2022
41ffaa0
chore: remove unused code
kettanaito Oct 17, 2022
547eecb
docs: add the migration guide
kettanaito Oct 17, 2022
e8fca8b
feat: support response body type generic
kettanaito Oct 17, 2022
6771bb3
fix(HttpResponse): accept "string" as input to ".json()"
kettanaito Oct 17, 2022
a4adce0
feat: support strict request body type
kettanaito Oct 17, 2022
490d2b8
test: add path params types tests
kettanaito Oct 17, 2022
62a7289
feat(graphql): support strict response body type
kettanaito Oct 17, 2022
7a56a7d
feat: support mock ReadableStream responses
kettanaito Oct 18, 2022
f3ee2f4
feat: handle request body as ArrayBuffer
kettanaito Oct 18, 2022
896ae0e
test: fix graphql typings tests
kettanaito Oct 18, 2022
f78175f
test: remove "set" typings tests
kettanaito Oct 18, 2022
b84fd6b
chore: remove unused "compose"
kettanaito Oct 18, 2022
533f44c
chore(NetworkError): add jsdoc
kettanaito Oct 18, 2022
b562f1f
fix(GraphQLHandler): annotate "errors" as partial
kettanaito Oct 18, 2022
6fd2eb8
chore(HttpResponse): remove unnecessary "defineReadOnly"
kettanaito Oct 18, 2022
6f07723
chore: move "HttpResponse" to the root
kettanaito Oct 18, 2022
d61a5db
test: add unit tests for HttpResponse
kettanaito Oct 18, 2022
801b5ae
chore: move fetch polyfills to root
kettanaito Oct 18, 2022
24a59e5
fix: correct types
kettanaito Oct 19, 2022
de0bd2f
fix(RequestHandler): set ResponseBodyType as undefined by default
kettanaito Oct 19, 2022
a27f6b7
test(cookies-inheritance): use a response body union type
kettanaito Oct 19, 2022
e005153
fix(bypass): support request generic to satisfy various polyfills
kettanaito Oct 21, 2022
03e6658
Merge branch 'main' into feat/standard-api
kettanaito Oct 21, 2022
f3894cf
chore: update to @mswjs/interceptors@0.18.0
kettanaito Nov 7, 2022
0157d82
chore: use @swc/jest vs ts-jest
kettanaito Nov 8, 2022
9b50319
fix(bypass): return [url, init] tuple for polyfill compatibility
kettanaito Nov 8, 2022
895e8e6
Merge branch 'main' into feat/standard-api
kettanaito Nov 14, 2022
10e3691
chore: fix failing bypass test
kettanaito Nov 14, 2022
8874812
chore: fix worker context event listener compatibility
kettanaito Nov 14, 2022
6861097
fix: typescript <= 4.4 compatibility
kettanaito Nov 14, 2022
b14380b
docs: improve migration guide
kettanaito Nov 15, 2022
b320fe5
test: fix response-patching test
kettanaito Nov 15, 2022
2684382
fix(bypass): forward request body
kettanaito Nov 15, 2022
085d52b
test: fix failing tests
kettanaito Nov 15, 2022
4edf17f
Merge branch 'main' into feat/standard-api
kettanaito Nov 15, 2022
77ca45a
Merge branch 'main' into feat/standard-api
kettanaito Nov 15, 2022
d84b2d0
chore: v0.0.0-fetch.rc-1
kettanaito Nov 15, 2022
b48b42e
Merge branch 'main' into feat/standard-api
kettanaito Nov 16, 2022
09218f3
docs(migrating): remove duplicate handler in set-cookies
kettanaito Nov 16, 2022
84978a0
docs: use HeadersInit for multi-value cookies
kettanaito Nov 17, 2022
3875d9b
chore(HttpResponse): remove commented code
kettanaito Nov 17, 2022
80ed635
docs: fix typo in migration guide (#1469)
Xayer Nov 18, 2022
cb2766d
Merge branch 'main' into feat/standard-api
kettanaito Nov 24, 2022
041ff3e
chore: v0.0.0-fetch.rc-2
kettanaito Nov 24, 2022
2f8bf27
fix(HttpResponse): accept interfaces as json response-data type (#1481)
christoph-fricke Nov 28, 2022
4bea835
docs(migrating): fix example for response composition (#1483)
christoph-fricke Dec 2, 2022
3a001af
docs(migrating): fix description for "ctx.errors" migration (#1487)
christoph-fricke Dec 2, 2022
7788593
Merge branch 'main' into feat/standard-api
kettanaito Dec 6, 2022
ffc51db
Merge branch 'main' into feat/standard-api
kettanaito Dec 7, 2022
9ba34e1
chore(release): v0.0.0-fetch.rc-3
kettanaito Dec 7, 2022
9607880
Merge branch 'main' into feat/standard-api
kettanaito Jan 11, 2023
6b87f2b
fix(decorateResponseInit): use global "Headers" if available
kettanaito Jan 11, 2023
d1e82e7
Merge branch 'main' into feat/standard-api
kettanaito Jan 14, 2023
cff6452
fix: update to @mswjs/interceptors@0.19.3
kettanaito Jan 14, 2023
021a080
Merge branch 'main' into feat/standard-api
kettanaito Jan 27, 2023
1bfd751
fix(worker): remove bypassing of server-sent events (#1551)
piotr-cz Feb 21, 2023
9a2446b
feat: drop support for node < 18
kettanaito Feb 27, 2023
b614531
Merge branch 'main' into feat/standard-api
kettanaito Feb 27, 2023
0fd5019
chore: fix unit tests
kettanaito Feb 27, 2023
d0a27ef
test(xhr): rewrite to fetch api
kettanaito Feb 27, 2023
7062869
chore: fix node tests
kettanaito Mar 1, 2023
603b24a
chore: use node 18 on ci
kettanaito Mar 3, 2023
e39b8fe
chore: move interceptors back to regular dependencies
kettanaito Mar 3, 2023
7acbf21
test: fix rest-api body mocks test
kettanaito Mar 3, 2023
fc38370
chore: fix browser tests
kettanaito Mar 3, 2023
69d2c65
chore(xhr): fix onload being called twice in tests
kettanaito Mar 4, 2023
5e92590
chore(release): v0.0.0-fetch.rc-4
kettanaito Mar 4, 2023
2273782
chore(release): v0.0.0-fetch.rc-5
kettanaito Mar 4, 2023
22cb9a1
feat: distribute library as cjs and esm
kettanaito Mar 7, 2023
c0c7f2a
fix: set "main" to node, use explicit "browser" field
kettanaito Mar 7, 2023
e4dce71
chore(release): 0.0.0-fetch.rc-6
kettanaito Mar 7, 2023
694bec9
test(on): clone response before reading it
kettanaito Mar 7, 2023
0f08330
chore: use node v18.14.2 internally
kettanaito Mar 7, 2023
a9cd280
test: unskip form-data node test
kettanaito Mar 7, 2023
e2c6d5a
Merge branch 'main' into feat/standard-api
kettanaito Mar 21, 2023
a369914
fix: update "strict-event-emitter" to 0.5.0
kettanaito Mar 21, 2023
37617c8
chore(release): v0.0.0-fetch.rc-7
kettanaito Mar 21, 2023
c347a9e
Merge branch 'main' into feat/standard-api
kettanaito Mar 23, 2023
2d57879
Merge branch 'main' into feat/standard-api
kettanaito Mar 24, 2023
bedcb2c
chore(release): v0.0.0-fetch.rc-8
kettanaito Mar 24, 2023
c4367a5
fix: migrate to "@open-draft/until@2"
kettanaito Mar 30, 2023
c5d6600
chore: update to "@mswjs/interceptors@0.22.10"
kettanaito Mar 30, 2023
472a358
chore: update to "page-with@0.6.1"
kettanaito Mar 30, 2023
14cf7d7
Merge branch 'main' into feat/standard-api
kettanaito Apr 6, 2023
7c6c9d9
feat: split the library into "core", "browser" and "node" (#1584)
kettanaito Apr 11, 2023
651e1a8
feat: export browser integration from "msw/browser" (#1591)
kettanaito Apr 11, 2023
206682f
docs: mention "msw/browser" change in migration guidelines
kettanaito Apr 11, 2023
f5637d1
chore(release): v0.0.0-fetch.rc-9
kettanaito Apr 11, 2023
34ae9da
fix: include "browser" in "files"
kettanaito Apr 12, 2023
e7153d9
chore(release): 0.0.0-fetch.rc-10
kettanaito Apr 12, 2023
76bac29
docs: add missing quote to migration guidelines (#1592)
koddsson Apr 12, 2023
6af4b3c
fix: ditch "debug" in favor of "@open-draft/logger"
kettanaito Apr 13, 2023
f4b4b4f
fix: use "statuses" plain object, list as dependency
kettanaito Apr 13, 2023
f656f0c
fix: bump to interceptors 0.22.12
kettanaito Apr 14, 2023
b8376e4
chore: explain "customConditions" in jest (jsdom)
kettanaito Apr 14, 2023
a4dadc9
chore: force exit node tests
kettanaito Apr 14, 2023
b816698
chore(release): v0.0.0-fetch.rc-11
kettanaito Apr 14, 2023
2331179
chore: add automated modules tests
kettanaito Apr 17, 2023
e48f435
chore: add runtime esm node test
kettanaito Apr 17, 2023
99402f6
fix: drop "chalk"
kettanaito Apr 17, 2023
1f81582
fix: use default import for cjs "statuses"
kettanaito Apr 17, 2023
0074b52
test: add runtime esm node.js tests
kettanaito Apr 17, 2023
a3b5c09
test: fix printHandlers location tests
kettanaito Apr 17, 2023
4c21110
chore: add browser module tests
kettanaito Apr 17, 2023
0fd26dc
chore: use "@web/dev-server" for browser esm tests
kettanaito Apr 18, 2023
4f3e05b
chore: update in-house dependencies for esm compat
kettanaito Apr 18, 2023
8ae5a4f
chore: use correct cjs deps imports
kettanaito Apr 18, 2023
f1749a6
chore: fix typescript package import in ts tests
kettanaito Apr 18, 2023
c7139df
fix(cookie): use manually bundled esm version
kettanaito Apr 20, 2023
9b27a12
chore: temporarily fix "process.env" for "graphql"
kettanaito Apr 25, 2023
7ff17ae
feat(HttpResponse): make initializable class
kettanaito Apr 28, 2023
0f35fd2
fix: esm fixes
thepassle Apr 29, 2023
100a43f
fix: annotate "@bundled-es-modules/statuses"
kettanaito Apr 29, 2023
94ec2ca
Merge branch 'main' into feat/standard-api
kettanaito Apr 29, 2023
36a0dcc
fix: cjs build of js-levenshtein
kettanaito Apr 29, 2023
229c967
chore(release): v0.0.0-fetch.rc-12
kettanaito Apr 29, 2023
cb565c9
fix: add "chalk@4" back to dependencies
kettanaito May 2, 2023
e20814e
chore(release): v0.0.0-fetch.rc-13
kettanaito May 2, 2023
b631430
Merge branch 'main' into feat/standard-api
kettanaito May 2, 2023
50c4c9c
fix: stream response chunks as they come in Node.js (#1606)
kettanaito May 3, 2023
8a527e9
fix: prevent "abort" listener memory leak in RequestHandler (#1608)
kettanaito May 7, 2023
b159c28
chore(release): v0.0.0-fetch.rc-14
kettanaito May 8, 2023
ed9275a
test: add response FormData browser test
kettanaito May 9, 2023
f663eeb
test: add Blob response browser test
kettanaito May 9, 2023
9c73b7d
test: add Blob json to request browser tests
kettanaito May 9, 2023
ccc576d
Merge branch 'main' into feat/standard-api
kettanaito May 12, 2023
2a287bc
feat: add "useRemoteHandlers" sync layer
kettanaito May 12, 2023
a20d446
fix: defer server connection to the first handler
kettanaito May 13, 2023
e9cc153
chore: use request/response serialize/deserialize utils
kettanaito May 13, 2023
7587800
chore: reuse req/res serialization for logging
kettanaito May 13, 2023
68727eb
chore: annotate sync server events map
kettanaito May 13, 2023
a2efc29
fix: bypass internal socket requests using "x-msw-request-type" header
kettanaito May 13, 2023
df07102
chore: use a single SYNC_SERVER_URL variable
kettanaito May 13, 2023
ceb507a
chore: use node polyfills for node tests in jest
kettanaito May 13, 2023
8bff5a0
feat: add "setupRemoteServer" API
kettanaito May 16, 2023
cedba0a
fix: await the server connection promise correctly
kettanaito May 17, 2023
598b1b7
fix: provide explicit exports from "setupRemoteServer"
kettanaito May 17, 2023
612a5ba
feat: support custom "MSW_INTERNAL_WEBSOCKET_PORT" env variable
kettanaito May 26, 2023
0f5c443
test(setupRemoteServer): add basic "use" test
kettanaito May 26, 2023
d27fc23
chore: move client creation to "setupRemoteServer"
kettanaito May 28, 2023
6e0c634
fix: format errors
kettanaito May 28, 2023
0bd22bb
feat(setupRemoteServer): support life-cycle events
kettanaito Jun 6, 2023
589eac6
Merge branch 'main' into feat/standard-api
kettanaito Jun 8, 2023
883d21f
Merge branch 'feat/standard-api' into feat/ws-sync-handlers
kettanaito Jun 8, 2023
b25655c
fix: normalize response status and status text when logging
kettanaito Jun 9, 2023
17f72e8
Merge branch 'main' into feat/standard-api
kettanaito Jun 9, 2023
f78d69e
Merge branch 'feat/standard-api' into feat/ws-sync-handlers
kettanaito Jun 13, 2023
a7caf12
test: add "Response.error" integration test
kettanaito Jun 29, 2023
82e3812
feat: do not set "x-powered-by" mocked response header
kettanaito Jun 29, 2023
8ca0287
chore: upgrade to @mswjs/interceptors@0.23.0
kettanaito Jun 29, 2023
1f06019
fix: rely on "isMockedResponse" to emit response events in node
kettanaito Jun 29, 2023
90f3989
feat: handle Response.error special use-case
kettanaito Jun 30, 2023
cff199d
test(response-patching): rely on custom "x-source" response header
kettanaito Jun 30, 2023
510f8b8
fix: upgrade to graphql@16.7.0, remove "process" workaround
kettanaito Jun 30, 2023
59c3e52
chore(release): v0.0.0-fetch.rc-15
kettanaito Jun 30, 2023
789327a
Merge branch 'main' into feat/standard-api
kettanaito Jul 20, 2023
47fd803
feat: make life-cycle event listeners have object argument
kettanaito Jul 20, 2023
61f6f3b
feat: remove the ".printHandlers()" method
kettanaito Jul 20, 2023
c371f03
feat: deprecate "rest" in favor of "http" (#1673)
kettanaito Jul 31, 2023
8943e1d
docs(passthrough): improve jsdoc description
kettanaito Jul 31, 2023
15db686
fix: remove unused utils modules
kettanaito Jul 31, 2023
90b854a
chore(release): v0.0.0-fetch.rc-16
kettanaito Aug 6, 2023
6adc652
Merge branch 'main' into feat/standard-api
kettanaito Aug 18, 2023
6239a0f
Merge branch 'main' into feat/standard-api
kettanaito Aug 18, 2023
bb02e57
test(graphql): add test on anonymous operation warning (#1693)
kettanaito Aug 18, 2023
5f3dd2a
Merge branch 'main' into feat/standard-api
kettanaito Aug 25, 2023
3b8f57e
fix(graphql): clone request before parsing (#1714)
kettanaito Aug 25, 2023
3fb29e5
chore(release): v0.0.0-fetch.rc-17
kettanaito Aug 25, 2023
223c17a
Merge branch 'main' into feat/standard-api
kettanaito Sep 2, 2023
a2b61ba
docs: add multipart-data common issue to migrating
kettanaito Sep 2, 2023
5034e48
Merge branch 'main' into feat/standard-api
kettanaito Sep 7, 2023
4ba43a5
chore: upgrade "headers-polyfill" to 3.2.3
kettanaito Sep 7, 2023
0898517
chore(release): v0.0.0-fetch.rc-18
kettanaito Sep 7, 2023
c5d03b0
Merge branch 'feat/standard-api' into feat/ws-sync-handlers
kettanaito Sep 7, 2023
b2b634c
fix: remove "NetworkError" in favor of "HttpResponse.error" (#1730)
kettanaito Sep 7, 2023
faa71c4
chore(release): v0.0.0-fetch.rc-19
kettanaito Sep 8, 2023
3eca8c7
fix(graphql): support request handler options (#1739)
kettanaito Sep 16, 2023
91989df
feat(worker): move exception handling from the worker (#1734)
kettanaito Sep 16, 2023
f1ff76a
Merge branch 'feat/standard-api' into feat/ws-sync-handlers
kettanaito Sep 16, 2023
0e8d362
chore: merge "main" into "feat/ws-sync-handlers"
kettanaito Oct 26, 2023
b8e9560
Merge branch 'main' into feat/ws-sync-handlers
kettanaito Oct 30, 2023
2325fd5
Merge branch 'main' into feat/ws-sync-handlers
kettanaito Nov 16, 2023
b3c4eda
Merge branch 'main' into feat/ws-sync-handlers
kettanaito Jan 7, 2024
1b85677
chore: minor adjustments
kettanaito Jan 7, 2024
c9d23c9
Merge branch 'main' into feat/ws-sync-handlers
kettanaito Jan 8, 2024
d9cc36c
chore(wip): continue
kettanaito Jan 13, 2024
1a27487
chore: update the remote-server test files
chrisb2244 Feb 9, 2024
4324133
fix(remote-server): bypass handling the socket.io connection
chrisb2244 Feb 9, 2024
20e640f
fix: add a static port to the tests for the remote-server listen calls
chrisb2244 Feb 9, 2024
aa75a6b
Merge remote-tracking branch 'origin/main' into feat/ws-sync-handlers
chrisb2244 Feb 13, 2024
64751b3
chore: revert addition of private function for remote handling
chrisb2244 Feb 13, 2024
048fb34
fix(remote-server): fix lifecycle handling when using a remote server
chrisb2244 Feb 13, 2024
1062a6b
fix: fix the type for the listen method
chrisb2244 Feb 13, 2024
d0b17a3
chore: extremely ugly console.logs but working playwright tests for N…
chrisb2244 Feb 14, 2024
3eb5b13
fix: make addition of passthrough socket handler conditional on remot…
chrisb2244 Feb 14, 2024
5c2b35d
chore: remove console logs and tidy comments
chrisb2244 Feb 15, 2024
087bff1
fix: add a private flag to mark prepended handlers
chrisb2244 Feb 15, 2024
45c9ef8
chore: remove unused branch
chrisb2244 Feb 15, 2024
c672589
chore: indentation to unblock CI
chrisb2244 Feb 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -128,6 +128,7 @@
"@bundled-es-modules/statuses": "^1.0.1",
"@inquirer/confirm": "^3.0.0",
"@mswjs/cookies": "^1.1.0",
"@open-draft/deferred-promise": "^2.1.0",
"@mswjs/interceptors": "^0.25.16",
"@open-draft/until": "^2.1.0",
"@types/cookie": "^0.6.0",
Expand All @@ -138,6 +139,8 @@
"is-node-process": "^1.2.0",
"outvariant": "^1.4.2",
"path-to-regexp": "^6.2.0",
"socket.io": "^4.6.1",
"socket.io-client": "^4.6.1",
"strict-event-emitter": "^0.5.1",
"type-fest": "^4.9.0",
"yargs": "^17.7.2"
Expand Down