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 PR contains the following updates:
0.0.0-fetch.rc-20
->2.0.0
Release Notes
mswjs/msw (msw)
v2.0.0
Compare Source
v2.0.0 (2023-10-23)
Breaking changes
< 4.7
.setupWorker
,SetupWorkerApi
, etc., must be imported frommsw/browser
now.rest
object tohttp
(rest.get
->http.get
).(req, res, ctx) => res()
but instead({ request }) => new Response()
.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..printHandlers()
method with.listHandlers()
.NetworkError
class in favor of the standardResponse.error()
.crypto.randomUUID()
instead ofMath.random()
in the worker.Features
Request
andResponse
instances respectively.ReadableStream
as a mocked response body.FormData
.FormData
as a mocked response body.File
polyfill in Node.js.{ once: true }
request handler option.RequestHandler
API public.Bug fixes
FormData
.FormData
response body.URLSearchParams
as the request body couldn’t be read.referrerPolicy
was reset to a different value than the original.XMLHttpRequest
events andreadyState
changes.responseType
equal to"arraybuffer"
as an incorrect buffer (previously, always assumed to be a string).XMLHttpRequest
events when the request fails.status
equal to 0 until the request actually resolves.onload
event callback was called twice forXMLHttpRequest
.@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.2
Compare Source
v1.3.2 (2023-10-01)
Bug Fixes
0a857f6
) @kettanaitov1.3.1
Compare Source
v1.3.1 (2023-09-13)
Bug Fixes
2e53ae7
) @kettanaitov1.3.0
Compare Source
v1.3.0 (2023-09-03)
Features
2ca791e
) @chentsulin @kettanaitov1.2.5
Compare Source
v1.2.5 (2023-08-28)
Bug Fixes
d35e851
) @kettanaitov1.2.4
Compare Source
v1.2.4 (2023-08-25)
Bug Fixes
a93f63b
) @blowery @kettanaitov1.2.3
Compare Source
v1.2.3 (2023-07-20)
Bug Fixes
daa04af
) @kettanaitov1.2.2
Compare Source
v1.2.2 (2023-06-09)
Bug Fixes
ReadableStream
responses as text/json (#1622) (4c7e952
) @esquevin @kettanaito8e37d9c
) @gthb @kettanaitov1.2.1
Compare Source
v1.2.1 (2023-03-24)
Bug Fixes
e7a6008
) @kettanaito4f44f11
) @cstengleinv1.2.0
Compare Source
v1.2.0 (2023-03-22)
Features
operationName
to GraphQL request (#1568) (115b435
) @ligaz @kettanaitov1.1.1
Compare Source
v1.1.1 (2023-03-20)
Bug Fixes
c0616d1
) @mattcosta7v1.1.0
Compare Source
v1.1.0 (2023-02-24)
Features
049f21d
) @kettanaitoBug Fixes
78d1834
) @kettanaitov1.0.1
Compare Source
v1.0.1 (2023-02-10)
Bug Fixes
12a581f
) @iceu-bb @kettanaitov1.0.0
Compare Source
v1.0.0 (2023-01-25)
4fde47e
) @gduliscouet-ubitransport @kettanaitoFeatures
b4ac829
) @kettanaitov0.49.3
Compare Source
v0.49.3 (2023-01-19)
Bug Fixes
6a94b8c
) @chrisguttandinv0.49.2
Compare Source
v0.49.2 (2022-12-13)
Bug Fixes
globalThis.fetch
inctx.fetch
utility (#1490) (42cdbc7
) @Toxiapo @kettanaitov0.49.1
Compare Source
v0.49.1 (2022-11-28)
Bug Fixes
c268796
) @gduliscouet-ubitransportv0.49.0
Compare Source
v0.49.0 (2022-11-19)
Features
af0277d
) @wtchnmv0.48.3
Compare Source
v0.48.3 (2022-11-15)
Bug Fixes
a06a944
) @kettanaitostatuses
dependency during the build (#1458) (99d49f9
) @mattcosta7 @kettanaitov0.48.2
Compare Source
v0.48.2 (2022-11-13)
Bug Fixes
f8d15b4
) @kettanaitov0.48.1
Compare Source
v0.48.1 (2022-11-10)
Bug Fixes
91b2902
) @cksal0805v0.48.0
Compare Source
v0.48.0 (2022-11-08)
Features
85ba844
) @Toxiapo @kettanaito670dda7
) @mucsi96 @kettanaito41798eb
) @ivanhofer @kettanaitov0.47.4
Compare Source
v0.47.4 (2022-10-04)
Bug Fixes
package.json
exports
field (#1395) (3902b8c
) @ivanhofer @kettanaito933a9d6
) @jkieboom @kettanaito78d155f
) @snaka @kettanaitov0.47.3
Compare Source
v0.47.3 (2022-09-15)
Bug Fixes
41d8c08
)v0.47.2
Compare Source
v0.47.2 (2022-09-13)
Bug Fixes
c90eafb
)v0.47.1
Compare Source
v0.47.1 (2022-09-10)
Bug Fixes
638fad9
)v0.47.0
Compare Source
v0.47.0 (2022-09-04)
Features
exports
map in package.json (#1383) (5e1c1a6
)v0.46.1
Compare Source
v0.46.1 (2022-09-01)
Bug Fixes
8436515
)v0.46.0
Compare Source
v0.46.0 (2022-08-31)
Features
62f7c4d
)631f629
)18f5778
)v0.45.0
Compare Source
v0.45.0 (2022-08-22)
Features
ca0e2e0
)v0.44.2
Compare Source
v0.44.2 (2022-07-19)
Bug Fixes
95be5f8
)v0.44.1
Compare Source
v0.44.1 (2022-07-14)
Bug Fixes
6a3f442
)v0.44.0
Compare Source
v0.44.0 (2022-07-13)
Breaking changes
req.destination
default value is now""
(empty string), previously"document"
.req.redirect
default value is now""follow"
, previously"manual"
.parseIsomorphicRequest()
function (#1316). Please useMockedRequest
class instead.Features
fc7f00c
). This means the addition of a few properties on thereq
instance:req.priority
, indicates a priority of request relatively to other requests (default"auto"
);req.text()
, reads the request body as plain text;req.json()
, reads the request body as JSON;req.arrayBuffer()
, reads the request body asArrayBuffer
;req.clone()
, clones a request instance (i.e. so its body could be read multiple times).6990c3a
)Deprecations
req.body
is deprecated. Please use explicit request body reading methods:req.text()
,req.json()
,req.arrayBuffer()
(other methods, likereq.formData()
are currently not supported).v0.43.1
Compare Source
v0.43.1 (2022-07-07)
Bug Fixes
66c3ad8
)v0.43.0
Compare Source
v0.43.0 (2022-07-04)
Features
78c7d7e
)v0.42.3
Compare Source
v0.42.3 (2022-06-22)
Bug Fixes
496154d
)v0.42.2
Compare Source
v0.42.2 (2022-06-22)
Bug Fixes
72f0b25
)v0.42.1
Compare Source
v0.42.1 (2022-06-07)
Bug Fixes
442f48d
)v0.42.0
Compare Source
v0.42.0 (2022-05-30)
Features
2176577
)Bug Fixes
61a755a
)v0.41.1
Compare Source
v0.41.1 (2022-05-27)
Bug Fixes
b020270
)v0.41.0
Compare Source
v0.41.0 (2022-05-22)
Features
00e9c58
)v0.40.2
Compare Source
v0.40.2 (2022-05-20)
Bug Fixes
5378416
)v0.40.1
Compare Source
v0.40.1 (2022-05-19)
Bug Fixes
3bca5be
)v0.40.0
Compare Source
v0.40.0 (2022-05-17)
Breaking changes
undefined
, or early returns, from response resolvers, now does not perform request as-is, and is instead treated as a handler that didn't do anything. Please returnreq.passthrough()
if you wish to bypass a request.Features
5c90799
)b70266f
)53aa3a1
)4e1b1ad
)ab3d399
)b1004a6
)Bug Fixes
cfe0709
)6f7ed98
)c3cd80a
)v0.39.2
Compare Source
Bug Fixes
v0.39.1
Compare Source
Bug Fixes
v0.39.0
Compare Source
Breaking changes
Bug Fixes
v0.38.2
Compare Source
Bug Fixes
v0.38.1
Compare Source
Bug Fixes
v0.38.0
Compare Source
Features
onUnhandledRequest
in a custom callback (https://github.com/mswjs/msw/pull/1096):v0.36.8
Compare Source
Bug Fixes
v0.36.7
Compare Source
Bug Fixes
localStorage
access (#1071) (99ae530)node-fetch
to 2.6.7 to fix a security vulnerability (#1072) (72a34f6)v0.36.5
Compare Source
Bug Fixes
Content-Type
header value (#1064) (7796418)v0.36.4
Compare Source
Bug fixes
v0.36.3
Compare Source
Bug fixes
x-msw-request-id
request header (#713, #1022, #1024).Internal
x-msw-request-id
header on the request (#1024). Relies on therequest.id
set by the interceptors (Node.js) or therequestId
generated by the worker (browser).v0.36.2
Compare Source
Bug fixes
rest.all()
request handler (#1020, #1021).v0.36.1
Compare Source
Bug fixes
v0.36.0
Compare Source
Breaking changes
/foo/bar?
);/foo/bar+
).string | string[]
(#999).RequestParams
generic now follows theRequestBodyType
generic, changing its order (#999):RequestParams
type (#999). Please use thePathParams
type instead.document.baseURI
(previouslylocation.origin
) in a browser-like environments (#1007, #1008).Features
rest.all()
request handler (#896). This handler captures all REST API requests regardless of method.SetupWorkerApi
andSetupServerApi
from the browser and Node.js modules respectively (#994).Bug fixes
typescript
as apeerDependency
to control supported TypeScript versions (#985).graphql.operation
handler producing a warning unable to intercept anonymous operations (#918, #904).inquirer
dependency version to 8.1.5 to propagate the fix for theUnexpected token “?”
issue when using MSW CLI (#917).TypeError: Failed to execute 'XXX' on 'Response': body stream already read
error when reading the original response body in the fallback mode (https://github.com/mswjs/interceptors/pull/152).Internal
@mswjs/cookies
and@mswjs/interceptors
as external packages so that their updates propagate to you automatically upon new installations ofmsw
.v0.35.0
Compare Source
v0.34.0
Compare Source
v0.33.3
Compare Source
v0.33.2
Compare Source
v0.33.1
Compare Source
v0.33.0
Compare Source
v0.32.3
Compare Source
v0.32.2
Compare Source
v0.32.1
Compare Source
v0.32.0
Compare Source
v0.31.0
Compare Source
v0.30.1
Compare Source
v0.30.0
Compare Source
v0.29.0
Compare Source
v0.28.2
Compare Source
Bug fixes
req.params
wasundefined
in case when request path had no parameters present (#682, #684). Thereq.params
value is always an object, regardless if you have path parameters defined.v0.28.1
Compare Source
Bug fixes
Content-Type
header (#671).v0.28.0
Compare Source
Breaking changes
response
instance in the life-cycle events now handlesresponse.headers
as theHeaders
instance (#660).setupServer
no longer applies request interception immediately. Instead, it's applied when calledserver.listen()
(#660).Bug fixes
XMLHttpRequest
in Node.js (https://github.com/mswjs/interceptors/pull/102).superagent
(#632).Internal
v0.27.2
Compare Source
Bug fixes
DropFirstInTuple
type used internally incompose.ts
(#658).v0.27.1
Compare Source
Changes
RestHandler
class publicly.Bug fixes
Uncaught ReferenceError: process is not defined
exception when callingworker.start()
(#609, #629).PickLastInTuple
type (#615, #627).TypeError: Object.fromEntries is not a function
error when running MSW in Node.js v10 (#625, #633).Internals
[email protected]
v0.27.0
Compare Source
Breaking changes
worker.start()
will now reject in the case of any errors during the worker registration (#607).RestRequestType
, useRestRequest
instead.GraphQLMockedRequest
, useGraphQLRequest
instead.GraphQLMockedContext
, useGraphQLContext
instead.GraphQLRequestPayload
, useGraphQLRequestBody
instead.GraphQLRequestParsedResult
, useParsedGraphQLRequest
instead.GraphQLResponseResolver
MockedRequest
type no longer have theparams
key (#561). Please use theRestRequest
type to annotate REST API requests instead.Features
msw.workerDirectory
property in your package.json:Starting from this release, whenever you install
msw
, it will try to locate themsw.workerDirectory
property in your package.json and copy the relevant worker script (mockServiceWorker.js
) to that directory.Whenever running
msw init
now, you will be prompted to save your public directory choice to package.json.msw init
you can pass the—save
option to automatically save the public directory in your package.json for future worker updates (#606). You can alternatively use--no-save
to bail out this step.Bug fixes
response:*
life-cycle events (#570).Internal
v0.26.2
Compare Source
Bug fixes
res.once
) affected multiple matching requests made in parallel (#583).OnUnhandledRequest
type as the newUnhandledRequestStrategy
type (#577).v0.26.1
Compare Source
Features
onUnhandledRequest
option will now suggest similar request handlers based on the URL/operation name similarity (#560).Bug fixes
Response
instance for theresponse:*
life-cycle event (#570).onUnhandledRequest: "error"
option resulted in a thrown exception being gracefully handled by Axios (#544). The"error"
value now prints tostderr
directly instead of throwing an exception. An original request-related exception will become visible now as well.v0.26.0
Compare Source
Features
[MSW] Mocking disabled
message when callingworker.stop()
. (#485, #493).Bug fixes
Failed to construct 'Response': The status provided (0) is outside the range [200, 599].
exception caused by an opaque response on the page (#529, #564). MSW will now skip opaque responses during the life-cycle events handling. You will not get theresponse:bypass
invoked upon an opaque response.ExecutionResult
ofgraphql
was not compatible withctx.data
andctx.errors
utilities (#522, #542).Internal
self
instead ofthis
in the worker script (#568).v0.25.0
Compare Source
Features
v0.24.4
Compare Source
Features
RestContext
type interface for public consumption (#524).v0.24.3
Compare Source
Features
<script>
tag (#507, #509).Internal
v0.24.2
Compare Source
v0.24.1
Compare Source
Improvements
v0.24.0
Compare Source
Breaking changes
ctx.json
context utility now always stringifies the response body (#468).Migration guidelines
Bug fixes
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.