chore(deps): update dependency msw to v2 (v1)
This MR contains the following updates:
Package | Type | Update | Change |
---|---|---|---|
msw (source) | devDependencies | major | ^1.3.2 -> ^2.0.0 |
Release Notes
mswjs/msw (msw)
v2.3.1
v2.3.1 (2024-06-01)
Bug Fixes
- preserve trailing optional path parameters (#2169) (
e69bbd6
) @kettanaito @KaiSpencer
v2.3.0
v2.3.0 (2024-05-08)
[!WARNING] This release changes how MSW treats unhandled exceptions in response resolvers. Previously, they were treated as request errors. Starting with this release, unhandled resolver exceptions will be coerced to
500 Unhandled Exception
mocked error responses produced by the library. Please note that you must not intentionally throw errors in your resolvers. Please useResponse.error()
to mock request/network errors. Unhandled exceptions are considered unintended and will be treated as if they happen on the actual server.
Features
- treat unhandled exceptions in handlers as 500 error responses (#2135) (
5191399
) @kettanaito - prioritize the
node
export when importingmsw/node
(#2134, transitively through @mswjs/interceptors). - add a new
unhandledException
event (#2135, docs).
server.events.on('unhandledException', ({ request, error }) => {
console.log('%s %s errored! See details below.', request.method, request.url)
console.error(error)
})
Bug Fixes
-
Disposable: make the ".dispose()" method synchronous (#2144) (
686d3d6
) @kettanaito
v2.2.14
v2.2.14 (2024-04-17)
Bug Fixes
- preserve search params in "onUnhandledRequest" messages (#2128) (
64bcae7
) @nagadevkrishna @kettanaito - give
node
export condition higher priority (#2134) (f948d13
) @phryneas
v2.2.13
v2.2.13 (2024-03-27)
Bug Fixes
- use
createRequestId()
instead ofcrypto.randomUUID()
(#2113) (8f2be77
) @kettanaito
v2.2.12
v2.2.12 (2024-03-27)
Bug Fixes
- do not mutate user-defined "X-Request-Id" request header (#2110) (
64b6ba5
) @kettanaito
v2.2.11
v2.2.11 (2024-03-26)
Bug Fixes
- accept a narrower response body type by default (#2107) (
d35ef92
) @kettanaito
v2.2.10
v2.2.10 (2024-03-22)
Bug Fixes
- feature "new URL()" in the redundant query params warning (#2102) (
9af301a
) @psjostrom @kettanaito
v2.2.9
v2.2.9 (2024-03-20)
Bug Fixes
- properly infer parameter and return types in
server.boundary()
(#2101) (1370736
) @Andarist @kettanaito
v2.2.8
v2.2.8 (2024-03-19)
Bug Fixes
-
setupWorker: remove left-over console.log() (#2099) (
cf97991
) @kettanaito
v2.2.7
v2.2.7 (2024-03-18)
Bug Fixes
- resolve "~/core" import for .d.mts modules (#2095) (
7cdbd1a
) @kettanaito
v2.2.6
v2.2.6 (2024-03-17)
Bug Fixes
-
setupWorker: emit the correct life-cycle events for bypassed requests (#2094) (
c485989
) @kettanaito -
bypass: support modifying the bypassed request (#2093) (
2c8570b
) @kettanaito
v2.2.5
v2.2.5 (2024-03-17)
Bug Fixes
- improve the worker integrity warning (#2091) (
e749355
) @kettanaito - make worker integrity mismatch a warning (#2090) (
a0f8021
) @kettanaito
v2.2.4
v2.2.4 (2024-03-16)
Bug Fixes
- resolve "@inquirer/confim" default export (#2088) (
93d9f86
) @kettanaito - parse "Set-Cookie" response header with commas correctly (#2075) (
23c16e6
) @ushiboy
v2.2.3
v2.2.3 (2024-03-08)
Bug Fixes
- remove the upper range for
typescript
peer dependency (#2077) (07cc073
) @kettanaito
v2.2.2
v2.2.2 (2024-02-28)
Bug Fixes
- set correct "Content-Length" response header for special characters (#2045) (#2046) (
eb3e284
) @ZeroCho
v2.2.1
v2.2.1 (2024-02-17)
Bug Fixes
- remove unused types (#2043) (
a78d57d
) @kettanaito
v2.2.0
v2.2.0 (2024-02-12)
Features
-
support concurrent test runs via "server.boundary" (announcement, #2000) (
450e7bc
) @kettanaito - automatically set "Content-Length" on text/json responses (#1996) (
a957235
) @kettanaito - add
msw/core/http
andmsw/core/graphql
export paths (#2004) (31442cf
) @thepassle @kettanaito - drop webpack 4 support (remove "chokidar") (#2021) (
a076142
) @sairus2k @kettanaito - use a lightweight "@inquirer/confirm" in the CLI (#2020) (
f25af8a
) @sairus2k @kettanaito
Bug Fixes
-
setupWorker: set "response.url" in "response:*" events (#2031) (
0e9d65f
) @kettanaito
v2.1.7
v2.1.7 (2024-02-06)
Bug Fixes
- support intercepting fetch requests in React Native (#2017) (
e430795
) @sairus2k @kettanaito - improve fetch compatibility with React Native (#2016) (
aeafcd2
) @kettanaito
Special thanks to @willdawsonme for investigating these issues.
v2.1.6
v2.1.6 (2024-02-05)
Bug Fixes
- return type of "passthrough" (#2002) (
b030db5
) @kettanaito
v2.1.5
v2.1.5 (2024-01-25)
Bug Fixes
- add "request" to response events (#1993) (
bad537f
) @kettanaito - does not warn on unhandled "file://" requests (#1997) (
5afedb1
) @kettanaito - resolve relative fetch urls in jsdom (#1999) (
82ab765
) @kettanaito
v2.1.4
v2.1.4 (2024-01-23)
Bug Fixes
- bundle browser build (#1988) (
1cbf615
) @thepassle @kettanaito - removes request parsing from "onUnhandledRequest" (#1990) (
bc0bea6
) @kettanaito
v2.1.3
v2.1.3 (2024-01-22)
Bug Fixes
- export "getResponse" for batched GraphQL queries (#1982) (
42f1473
) @kettanaito - reduce library footprint by avoiding barrel imports (#1987) (
b803e26
) @thepassle
v2.1.2
v2.1.2 (2024-01-17)
Bug Fixes
- export "HttpRequestHandler" and "GraphQLRequestHandler" types (#1973) (
ca423d9
) @kettanaito
v2.1.1
v2.1.1 (2024-01-17)
Bug Fixes
v2.1.0
v2.1.0 (2024-01-15)
Features
- up tsconfig target for more modern syntax (#1780) (
29182ce
) @thepassle @kettanaito - add "requestId" as response resolver argument (#1942) (
51ab8cc
) @skvale @kettanaito - support multiple directories in "msw.workerDirectory" (#1832) (
4dbf99a
) @kettanaito - deprecate "waitUntilReady" (deferNetworkUntil) worker option (#1964) (
86a22ac
) @kettanaito - support throwing responses in response resolvers (#1963) (
39dc0e6
) @kettanaito
Shoutout to @mattcosta7 for his continuous on the library's performance and stability
v2.0.14
v2.0.14 (2024-01-12)
Bug Fixes
-
GraphQLHandler: move cookie parsing to parse phase (#1957) (
ba87f99
) @mattcosta7 @kettanaito - improve custom request handler and resolver annotations (#1961) (
8624f31
) @kettanaito
v2.0.13
v2.0.13 (2024-01-09)
Bug Fixes
- publish source and include sourcemaps (#1958) (
68a57bd
) @kettanaito
v2.0.12
v2.0.12 (2024-01-05)
Bug Fixes
- cache request cloning and request parsing (#1914) (
a79a9d7
) @mattcosta7 @kettanaito - support typescript@5.3 (#1874) (
1da80bb
) @falsepopsky @mattcosta7 @kettanaito
v2.0.11
v2.0.11 (2023-12-11)
Bug Fixes
- expose mockServiceWorker.js file in package exports (#1922) (
5736efc
) @thepassle
v2.0.10
v2.0.10 (2023-12-04)
Bug Fixes
- null-body responses enforced in createResponseListener instead o… (#1895) (
ed09722
) @mattcosta7
v2.0.9
v2.0.9 (2023-11-24)
Bug Fixes
- skip parsing GraphQL requests if the request url doesn't match (#1871) (
565e802
) @mattcosta7 @kettanaito - throw on invalid request handlers value in ".use()" (#1876) (
ce73dfe
) @kettanaito - resolve segfault issue caused by "node:events" import (#1885) (
f188d77
) @mattcosta7 @kettanaito
v2.0.8
v2.0.8 (2023-11-17)
Bug Fixes
-
graphql: allow null for "data" and "errors" response property types (#1867) (
a7ffd32
) @kettanaito
v2.0.7
v2.0.7 (2023-11-16)
Bug Fixes
- encode cookie string before forwarding request cookies (#1815) (
c2d8e98
) @Jungzl @kettanaito -
react-native: import "node:events" lazily (#1858) (
0d79ec4
) @kettanaito - change request cookie type to be Record<string, string> (#1857) (
75bbb96
) @ezzatron @kettanaito
v2.0.6
v2.0.6 (2023-11-13)
Bug Fixes
-
GraphQL: expose request cookies in "cookies" argument (#1853) (
463b74f
) @kettanaito - correct docs link for anonymous GraphQL operations (#1850) (
e628278
) @okkimus @kettanaito
v2.0.5
v2.0.5 (2023-11-10)
Bug Fixes
-
xhr: support environments without location (React Native) (#1849) (
f6601d9
) @kettanaito
v2.0.4
v2.0.4 (2023-11-08)
Bug Fixes
- safely access "request.credentials" in cloudflare (#1845) (
bd0cec7
) @kettanaito @mattcosta7 - safely access "Response.type" in cloudflare (#1846) (
ccd7096
) @kettanaito @mattcosta7 - allow setting "timeout" on XMLHttpRequest (#1844) (
6296429
) @kettanaito - update @mswjs/interceptors to 0.25.8 (#1842) (
629a3cf
) @kettanaito - allow overriding "Content-Type" in HttpResponse static methods (#1839) (
a037e3a
) @kettanaito - narrow
body
type forHttpResponse.json()
to be serializable json (#1838) (2af274c
) @kettanaito - remove "formdata-node" dependency (#1837) (
d49d48e
) @kettanaito
v2.0.3
v2.0.3 (2023-11-04)
Bug Fixes
- correctly check "undefined" as response body type (#1824) (
a0ec8be
) @kettanaito -
Safari: send explicit null response bodies (#1833) (
66fb437
) @kettanaito
v2.0.2
v2.0.2 (2023-11-01)
Bug Fixes
- output a single formatted message to console (#1820) (
2ead392
) @kettanaito - prevent one-time handlers from incorrectly marking themselves as used (#1822) (
a179b68
) @joshkel - resolve the "eventTargets" error in JSDOM by dropping "instanceof" (#1813) (
f6e5112
) @mattcosta7
v2.0.1
v2.0.1 (2023-10-28)
Bug Fixes
v2.0.0
v2.0.0 (2023-10-23)
[!IMPORTANT] This release is a BREAKING CHANGE. Please follow the Migration guidelines to upgrade. This release took a lot of effort to make, and I expect a bit of that effort on your part while upgrading. Most of the changes are mechanical, and a simple Find/Replace All will get you a long way. For the rest of it, you will learn how to handle requests and responses using the standard JavaScript API. Thank you!
Breaking changes
- Drops support for Node.js 16. Please upgrade to Node.js 18 or later to use the global Fetch API.
- Drops support for TypeScript
< 4.7
. - All browser-side exports, like
setupWorker
,SetupWorkerApi
, etc., must be imported frommsw/browser
now. - Renames the
rest
object tohttp
(rest.get
->http.get
).
- Response resolver call signature is no longer
(req, res, ctx) => res()
but instead({ request }) => new Response()
.
- The following exports are removed due to no longer being needed:
response
-
context
and related exports (defaultContext
,restContext
,graphqlContext
). -
compose
andcreateResponseComposition
-
res.once()
is removed in favor of the{ once: boolean }
option on the request handler. - Replaces the
.printHandlers()
method with.listHandlers()
. - Removes the
NetworkError
class in favor of the standardResponse.error()
. - Moves request error handling from the worker thread to the client thread.
- Changes the call signature of the Life-cycle Events API to accept a single object argument.
- Uses
crypto.randomUUID()
instead ofMath.random()
in the worker. - For the full list of changes and detailed instructions on how to upgrade please see the Migration guidelines.
Features
-
Adopts Fetch API primitives. Represent intercepted requests and mocked responses as
Request
andResponse
instances respectively. - Supports Node.js v18.
- Supports
ReadableStream
as a mocked response body. - Supports reading the intercepted request body as
FormData
. - Supports
FormData
as a mocked response body. - Uses
File
polyfill in Node.js. - Supports XMLHttpRequest “upload” events when responding with a mocked stream response.
- Allows mocking a network error once using the
{ once: true }
request handler option. - Makes the
RequestHandler
API public.
Bug fixes
- Fixes the issue where the request body couldn’t be properly read as
FormData
. - Fixes a set of issues related to response patching when using the
FormData
response body. - Fixes the issue where
URLSearchParams
as the request body couldn’t be read. - Fixes the issue where a bypassed request’s
referrerPolicy
was reset to a different value than the original.
- Fixes the wrong order of
XMLHttpRequest
events andreadyState
changes. - Fixes the issue when reading an XMLHttpRequest body of
responseType
equal to"arraybuffer"
as an incorrect buffer (previously, always assumed to be a string). - Fixes the order of
XMLHttpRequest
events when the request fails. - Keeps XMLHttpRequest
status
equal to 0 until the request actually resolves. - Fixes the issue when the
onload
event callback was called twice forXMLHttpRequest
. - Various improvements in Node.js network behavior compliance.
@dbritto-dev @ddolcimascolo @markwhitfeld @christoph-fricke @thepassle @piotr-cz @mattcosta7 @koddsson @dkobierski @ricardocosta @dxlbnl @zkochan @felipefreitag @weyert @95th @committomaster @Xayer @Kosai106 @colinsullivan @xmlking @thw0rted @lee-reinhardt @wKovacs64 @TeChn4K @cmolina @nickrttn @thomasbertet @mscottnelson @jonnedeprez @negabaro @the-ult @WesleyYue @cwagner22 @skvale @alawiii521 @csantos1113 @elliotgonzalez123 @committomaster @tsteckenborn @xxleyi @jonnedeprez @danny-does-stuff @lemcii @mattrodak @luisr-carrillo @lee-reinhardt @ealejandrootalvaro @tomdglenn91
v1.3.3
v1.3.3 (2024-03-15)
Bug Fixes
- remove upper version range for "typescript" (#2086) (
8f456bb
) @kettanaito
Configuration
-
If you want to rebase/retry this MR, check this box
This MR has been generated by Renovate Bot.