msw

Seamless REST/GraphQL API mocking library for browser and Node.js.

MIT License

Downloads
15.7M
Stars
14.9K
Committers
153

Bot releases are hidden (Show)

msw - v2.0.11

Published by kettanaito 11 months ago

v2.0.11 (2023-12-11)

Bug Fixes

  • expose mockServiceWorker.js file in package exports (#1922) (5736efce63c0271ba37c69d2a7267e5cc614a444) @thepassle
msw - v2.0.10

Published by kettanaito 11 months ago

v2.0.10 (2023-12-04)

Bug Fixes

  • null-body responses enforced in createResponseListener instead o… (#1895) (ed09722b327fc81f1a6f8d4d600445629877179e) @mattcosta7
msw - v2.0.9

Published by kettanaito 11 months ago

v2.0.9 (2023-11-24)

Bug Fixes

  • skip parsing GraphQL requests if the request url doesn't match (#1871) (565e802c6dd0f971f939d7adcbeb82cf2de1af59) @mattcosta7 @kettanaito
  • throw on invalid request handlers value in ".use()" (#1876) (ce73dfecee7b20a131e6a020c5e6661987b0d3ce) @kettanaito
  • resolve segfault issue caused by "node:events" import (#1885) (f188d7724a31ab685d68d0ea84949999b6eea5f3) @mattcosta7 @kettanaito
msw - v2.0.8

Published by kettanaito 11 months ago

v2.0.8 (2023-11-17)

Bug Fixes

  • graphql: allow null for "data" and "errors" response property types (#1867) (a7ffd32981fcda8acb70af28502ae7e98d16b353) @kettanaito
msw - v2.0.7

Published by kettanaito 11 months ago

v2.0.7 (2023-11-16)

Bug Fixes

  • encode cookie string before forwarding request cookies (#1815) (c2d8e986ba7b44f6ba5da88164f6018fc4466d85) @Jungzl @kettanaito
  • react-native: import "node:events" lazily (#1858) (0d79ec4d5b5c554eacf6acfa383f7a2721a94ea7) @kettanaito
  • change request cookie type to be Record<string, string> (#1857) (75bbb966158fe6d0fc450e1071b676e0f29fdbfa) @ezzatron @kettanaito
msw - v2.0.6

Published by kettanaito 12 months ago

v2.0.6 (2023-11-13)

Bug Fixes

  • GraphQL: expose request cookies in "cookies" argument (#1853) (463b74faaf445a4f751f8a25c67a8f98627f27f5) @kettanaito
  • correct docs link for anonymous GraphQL operations (#1850) (e62827860e3b6ef291ada81d96025af2755e2505) @okkimus @kettanaito
msw - v2.0.5

Published by kettanaito 12 months ago

v2.0.5 (2023-11-10)

Bug Fixes

  • xhr: support environments without location (React Native) (#1849) (f6601d995a3ddf0f2b5763a87a04ec132b649ed1) @kettanaito
msw - v2.0.4

Published by kettanaito 12 months ago

v2.0.4 (2023-11-08)

Bug Fixes

  • safely access "request.credentials" in cloudflare (#1845) (bd0cec7a2163ab47301608c1712c55f1cf04327a) @kettanaito @mattcosta7
  • safely access "Response.type" in cloudflare (#1846) (ccd709614129739dea3bcb767c1f9e3809ae1d2b) @kettanaito @mattcosta7
  • allow setting "timeout" on XMLHttpRequest (#1844) (62964292728398344beda0ffc16e4ca388ba0245) @kettanaito
  • update @mswjs/interceptors to 0.25.8 (#1842) (629a3cf8248d7d9e21f524210d7282cab44f35ab) @kettanaito
  • allow overriding "Content-Type" in HttpResponse static methods (#1839) (a037e3a3f4f4d4cc712d2b3867b3410e4bcfaad6) @kettanaito
  • narrow body type for HttpResponse.json() to be serializable json (#1838) (2af274c154d2e0b696188c10ba1f0271e900c40a) @kettanaito
  • remove "formdata-node" dependency (#1837) (d49d48e9ca6467aeea16f4c3345789626a0396f2) @kettanaito
msw - v2.0.3

Published by kettanaito 12 months ago

v2.0.3 (2023-11-04)

Bug Fixes

  • correctly check "undefined" as response body type (#1824) (a0ec8be311daef0285d8485e315bbb49a9370f44) @kettanaito
  • Safari: send explicit null response bodies (#1833) (66fb437c0936651cf0bb936f21aa77054b147857) @kettanaito
msw - v2.0.2

Published by kettanaito 12 months ago

v2.0.2 (2023-11-01)

Bug Fixes

  • output a single formatted message to console (#1820) (2ead3922f3ec5a4750e3b9e09e75aeb20f13c736) @kettanaito
  • prevent one-time handlers from incorrectly marking themselves as used (#1822) (a179b68e2dfd3667999c31b1dbd3870a0b92568c) @joshkel
  • resolve the "eventTargets" error in JSDOM by dropping "instanceof" (#1813) (f6e5112fa0f1ebbd97fb95bcbda1c47a0cc750f9) @mattcosta7
msw - v2.0.1

Published by kettanaito 12 months ago

v2.0.1 (2023-10-28)

Bug Fixes

  • clone response early for response logging (#1799) (5c5470a0f2204b4164fcc65e210471661208ce4d) @kunmagg
msw - v2.0.0

Published by kettanaito almost 1 year ago

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 from msw/browser now.
  • Renames the rest object to http (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 and createResponseComposition
  • 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 standard Response.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 of Math.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 and Response 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 and readyState 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 for XMLHttpRequest.
  • 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

msw - v1.3.2

Published by kettanaito about 1 year ago

v1.3.2 (2023-10-01)

Bug Fixes

  • set minimal "graphql" version to 16.18.1 (#1754) (0a857f67b6e0883336a790633aa9bafc0b16c7cb) @kettanaito
msw - v1.3.1

Published by kettanaito about 1 year ago

v1.3.1 (2023-09-13)

Bug Fixes

  • pin "headers-polyfill" to 3.2.5 (#1736) (2e53ae73bd734c435ac447ca2b60cdaaebc1390b) @kettanaito
msw - v1.3.0

Published by kettanaito about 1 year ago

v1.3.0 (2023-09-03)

Features

  • support TypeScript 5.2 (#1711) (2ca791e437256452f63b95cf5ef19c91c7ac0b9a) @chentsulin @kettanaito
msw - v1.2.5

Published by kettanaito about 1 year ago

v1.2.5 (2023-08-28)

Bug Fixes

  • allow installs with any version of pnpm (#1713) (d35e851faa3d75b58b8051084c50b7f02491df84) @kettanaito
msw - v1.2.4

Published by kettanaito about 1 year ago

v1.2.4 (2023-08-25)

Bug Fixes

  • dependency: unpin the "chalk" dependency (#1639) (a93f63b345dc46548e42b71954b16b4a87d90fb8) @blowery @kettanaito
msw - v1.2.3

Published by kettanaito over 1 year ago

v1.2.3 (2023-07-20)

Bug Fixes

  • clone Response before logging (#1662) (daa04af4075b06607b81ed23bbe5ea09d56e8825) @kettanaito
msw - v1.2.2

Published by kettanaito over 1 year ago

v1.2.2 (2023-06-09)

Bug Fixes

  • log ReadableStream responses as text/json (#1622) (4c7e952e69f1a82115fafa695ae39b3169486570) @esquevin @kettanaito
  • support typescript 5.1 as a peer dependency (#1633) (8e37d9cbdef16bc6f5c1146a493bfced49657a5d) @gthb @kettanaito
msw - v1.2.1

Published by kettanaito over 1 year ago

v1.2.1 (2023-03-24)

Bug Fixes

  • update dependencies to support ESM (#1575) (e7a60081526bd6f00ac17a62c424abf59976555b) @kettanaito
  • update "headers-polyfill" to 3.1.2 to fix the ESM issue (#1571) (4f44f115e28d35ff137c7ccf886c0029399b5d30) @cstenglein