Skip to content

Commit

Permalink
Update dependency msw to v2 (#513)
Browse files Browse the repository at this point in the history
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [msw](https://mswjs.io) ([source](https://togithub.com/mswjs/msw)) | [`^1.2.2` -> `^2.0.0`](https://renovatebot.com/diffs/npm/msw/1.2.2/2.0.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/msw/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/msw/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/msw/1.2.2/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/msw/1.2.2/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>mswjs/msw (msw)</summary>

### [`v2.0.0`](https://togithub.com/mswjs/msw/releases/tag/v2.0.0)

[Compare Source](https://togithub.com/mswjs/msw/compare/v1.3.2...v2.0.0)

#### v2.0.0 (2023-10-23)

> \[!IMPORTANT]
> **This release is a BREAKING CHANGE**. Please follow the [Migration guidelines](https://mswjs.io/docs/migrations/1.x-to-2.x) 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](docs/migrations/1.x-to-2.x).**

#### 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.

[@&#8203;dbritto-dev](https://togithub.com/dbritto-dev) [@&#8203;ddolcimascolo](https://togithub.com/ddolcimascolo) [@&#8203;markwhitfeld](https://togithub.com/markwhitfeld) [@&#8203;christoph-fricke](https://togithub.com/christoph-fricke) [@&#8203;thepassle](https://togithub.com/thepassle) [@&#8203;piotr-cz](https://togithub.com/piotr-cz) [@&#8203;mattcosta7](https://togithub.com/mattcosta7) [@&#8203;koddsson](https://togithub.com/koddsson) [@&#8203;dkobierski](https://togithub.com/dkobierski) [@&#8203;ricardocosta](https://togithub.com/ricardocosta) [@&#8203;dxlbnl](https://togithub.com/dxlbnl) [@&#8203;zkochan](https://togithub.com/zkochan) [@&#8203;felipefreitag](https://togithub.com/felipefreitag) [@&#8203;weyert](https://togithub.com/weyert) [@&#8203;95th](https://togithub.com/95th) [@&#8203;committomaster](https://togithub.com/committomaster) [@&#8203;Xayer](https://togithub.com/Xayer) [@&#8203;Kosai106](https://togithub.com/Kosai106) [@&#8203;colinsullivan](https://togithub.com/colinsullivan) [@&#8203;xmlking](https://togithub.com/xmlking) [@&#8203;thw0rted](https://togithub.com/thw0rted) [@&#8203;lee-reinhardt](https://togithub.com/lee-reinhardt) [@&#8203;wKovacs64](https://togithub.com/wKovacs64) [@&#8203;TeChn4K](https://togithub.com/TeChn4K) [@&#8203;cmolina](https://togithub.com/cmolina) [@&#8203;nickrttn](https://togithub.com/nickrttn) [@&#8203;thomasbertet](https://togithub.com/thomasbertet) [@&#8203;mscottnelson](https://togithub.com/mscottnelson) [@&#8203;jonnedeprez](https://togithub.com/jonnedeprez) [@&#8203;negabaro](https://togithub.com/negabaro) [@&#8203;the-ult](https://togithub.com/the-ult) [@&#8203;WesleyYue](https://togithub.com/WesleyYue) [@&#8203;cwagner22](https://togithub.com/cwagner22) [@&#8203;skvale](https://togithub.com/skvale) [@&#8203;alawiii521](https://togithub.com/alawiii521) [@&#8203;csantos1113](https://togithub.com/csantos1113) [@&#8203;elliotgonzalez123](https://togithub.com/elliotgonzalez123) [@&#8203;committomaster](https://togithub.com/committomaster) [@&#8203;tsteckenborn](https://togithub.com/tsteckenborn) [@&#8203;xxleyi](https://togithub.com/xxleyi) [@&#8203;jonnedeprez](https://togithub.com/jonnedeprez) [@&#8203;danny-does-stuff](https://togithub.com/danny-does-stuff) [@&#8203;lemcii](https://togithub.com/lemcii) [@&#8203;mattrodak](https://togithub.com/mattrodak) [@&#8203;luisr-carrillo](https://togithub.com/luisr-carrillo) [@&#8203;lee-reinhardt](https://togithub.com/lee-reinhardt) [@&#8203;ealejandrootalvaro](https://togithub.com/ealejandrootalvaro) [@&#8203;tomdglenn91](https://togithub.com/tomdglenn91)

### [`v1.3.2`](https://togithub.com/mswjs/msw/releases/tag/v1.3.2)

[Compare Source](https://togithub.com/mswjs/msw/compare/v1.3.1...v1.3.2)

#### v1.3.2 (2023-10-01)

##### Bug Fixes

-   set minimal "graphql" version to 16.18.1 ([#&#8203;1754](https://togithub.com/mswjs/msw/issues/1754)) ([`0a857f6`](https://togithub.com/mswjs/msw/commit/0a857f67b6e0883336a790633aa9bafc0b16c7cb)) [@&#8203;kettanaito](https://togithub.com/kettanaito)

### [`v1.3.1`](https://togithub.com/mswjs/msw/releases/tag/v1.3.1)

[Compare Source](https://togithub.com/mswjs/msw/compare/v1.3.0...v1.3.1)

#### v1.3.1 (2023-09-13)

##### Bug Fixes

-   pin "headers-polyfill" to 3.2.5 ([#&#8203;1736](https://togithub.com/mswjs/msw/issues/1736)) ([`2e53ae7`](https://togithub.com/mswjs/msw/commit/2e53ae73bd734c435ac447ca2b60cdaaebc1390b)) [@&#8203;kettanaito](https://togithub.com/kettanaito)

### [`v1.3.0`](https://togithub.com/mswjs/msw/releases/tag/v1.3.0)

[Compare Source](https://togithub.com/mswjs/msw/compare/v1.2.5...v1.3.0)

#### v1.3.0 (2023-09-03)

##### Features

-   support TypeScript 5.2 ([#&#8203;1711](https://togithub.com/mswjs/msw/issues/1711)) ([`2ca791e`](https://togithub.com/mswjs/msw/commit/2ca791e437256452f63b95cf5ef19c91c7ac0b9a)) [@&#8203;chentsulin](https://togithub.com/chentsulin) [@&#8203;kettanaito](https://togithub.com/kettanaito)

### [`v1.2.5`](https://togithub.com/mswjs/msw/releases/tag/v1.2.5)

[Compare Source](https://togithub.com/mswjs/msw/compare/v1.2.4...v1.2.5)

#### v1.2.5 (2023-08-28)

##### Bug Fixes

-   allow installs with any version of pnpm ([#&#8203;1713](https://togithub.com/mswjs/msw/issues/1713)) ([`d35e851`](https://togithub.com/mswjs/msw/commit/d35e851faa3d75b58b8051084c50b7f02491df84)) [@&#8203;kettanaito](https://togithub.com/kettanaito)

### [`v1.2.4`](https://togithub.com/mswjs/msw/releases/tag/v1.2.4)

[Compare Source](https://togithub.com/mswjs/msw/compare/v1.2.3...v1.2.4)

#### v1.2.4 (2023-08-25)

##### Bug Fixes

-   **dependency:** unpin the "chalk" dependency ([#&#8203;1639](https://togithub.com/mswjs/msw/issues/1639)) ([`a93f63b`](https://togithub.com/mswjs/msw/commit/a93f63b345dc46548e42b71954b16b4a87d90fb8)) [@&#8203;blowery](https://togithub.com/blowery) [@&#8203;kettanaito](https://togithub.com/kettanaito)

### [`v1.2.3`](https://togithub.com/mswjs/msw/releases/tag/v1.2.3)

[Compare Source](https://togithub.com/mswjs/msw/compare/v1.2.2...v1.2.3)

#### v1.2.3 (2023-07-20)

##### Bug Fixes

-   clone Response before logging ([#&#8203;1662](https://togithub.com/mswjs/msw/issues/1662)) ([`daa04af`](https://togithub.com/mswjs/msw/commit/daa04af4075b06607b81ed23bbe5ea09d56e8825)) [@&#8203;kettanaito](https://togithub.com/kettanaito)

</details>

---

### 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.

---

 - [ ] If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/X-oss-byte/Nextjs).
  • Loading branch information
renovate[bot] authored Oct 23, 2023
1 parent a8e8ccd commit fb0e151
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 127 deletions.
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
"lru-cache": "10.0.1",
"micromatch": "4.0.5",
"mini-css-extract-plugin": "2.7.6",
"msw": "^1.2.2",
"msw": "^2.0.0",
"nanoid": "5.0.2",
"native-url": "0.3.4",
"neo-async": "2.6.2",
Expand Down
187 changes: 61 additions & 126 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fb0e151

Please sign in to comment.