Skip to content

Commit

Permalink
Bump msw from 1.3.2 to 2.0.0 (sergiodxa#264)
Browse files Browse the repository at this point in the history
Bumps [msw](https://github.com/mswjs/msw) from 1.3.2 to 2.0.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/mswjs/msw/releases">msw's
releases</a>.</em></p>
<blockquote>
<h2>v2.0.0 (2023-10-23)</h2>
<blockquote>
<p>[!IMPORTANT]
<strong>This release is a BREAKING CHANGE</strong>. Please follow the <a
href="https://mswjs.io/docs/migrations/1.x-to-2.x">Migration
guidelines</a> 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!</p>
</blockquote>
<h2>Breaking changes</h2>
<ul>
<li><strong>Drops support for Node.js 16</strong>. Please upgrade to
Node.js 18 or later to use the global Fetch API.</li>
<li><strong>Drops support for TypeScript <code>&lt;
4.7</code>.</strong></li>
<li>All browser-side exports, like <code>setupWorker</code>,
<code>SetupWorkerApi</code>, etc., must be imported from
<code>msw/browser</code> now.</li>
<li>Renames the <code>rest</code> object to <code>http</code>
(<code>rest.get</code> -&gt; <code>http.get</code>).</li>
</ul>
<ul>
<li>Response resolver call signature is no longer <code>(req, res, ctx)
=&gt; res()</code> but instead <code>({ request }) =&gt; new
Response()</code>.</li>
</ul>
<ul>
<li>The following exports are removed due to no longer being needed:
<ul>
<li><code>response</code></li>
<li><code>context</code> and related exports
(<code>defaultContext</code>, <code>restContext</code>,
<code>graphqlContext</code>).</li>
<li><code>compose</code> and <code>createResponseComposition</code></li>
</ul>
</li>
<li><code>res.once()</code> is removed in favor of the <code>{ once:
boolean }</code> option on the request handler.</li>
<li>Replaces the <code>.printHandlers()</code> method with
<code>.listHandlers()</code>.</li>
<li>Removes the <code>NetworkError</code> class in favor of the standard
<code>Response.error()</code>.</li>
<li>Moves request error handling from the worker thread to the client
thread.</li>
<li>Changes the call signature of the Life-cycle Events API to accept a
single object argument.</li>
<li>Uses <code>crypto.randomUUID()</code> instead of
<code>Math.random()</code> in the worker.</li>
<li><strong>For the full list of changes and detailed instructions on
how to upgrade please see the <a
href="https://github.com/mswjs/msw/blob/HEAD/docs/migrations/1.x-to-2.x">Migration
guidelines</a>.</strong></li>
</ul>
<h2>Features</h2>
<ul>
<li><strong>Adopts Fetch API primitives</strong>. Represent intercepted
requests and mocked responses as <code>Request</code> and
<code>Response</code> instances respectively.</li>
<li><strong>Supports Node.js v18</strong>.</li>
<li>Supports <code>ReadableStream</code> as a mocked response body.</li>
<li>Supports reading the intercepted request body as
<code>FormData</code>.</li>
<li>Supports <code>FormData</code> as a mocked response body.</li>
<li>Uses  <code>File</code> polyfill in Node.js.</li>
<li>Supports XMLHttpRequest “upload” events when responding with a
mocked stream response.</li>
<li>Allows mocking a network error once using the <code>{ once: true
}</code> request handler option.</li>
<li>Makes the <code>RequestHandler</code> API public.</li>
</ul>
<h2>Bug fixes</h2>
<ul>
<li>Fixes the issue where the request body couldn’t be properly read as
<code>FormData</code>.</li>
<li>Fixes a set of issues related to response patching when using the
<code>FormData</code> response body.</li>
<li>Fixes the issue where <code>URLSearchParams</code> as the request
body couldn’t be read.</li>
<li>Fixes the issue where a bypassed request’s
<code>referrerPolicy</code> was reset to a different value than the
original.</li>
</ul>
<ul>
<li>Fixes the wrong order of <code>XMLHttpRequest</code> events and
<code>readyState</code> changes.</li>
<li>Fixes the issue when reading an XMLHttpRequest body of
<code>responseType</code> equal to <code>&quot;arraybuffer&quot;</code>
as an incorrect buffer (previously, always assumed to be a string).</li>
<li>Fixes the order of <code>XMLHttpRequest</code> events when the
request fails.</li>
<li>Keeps XMLHttpRequest <code>status</code> equal to 0 until the
request actually resolves.</li>
<li>Fixes the issue when the <code>onload</code> event callback was
called twice for <code>XMLHttpRequest</code>.</li>
<li>Various improvements in Node.js network behavior compliance.</li>
</ul>
<p><a
href="https://github.com/dbritto-dev"><code>@​dbritto-dev</code></a> <a
href="https://github.com/ddolcimascolo"><code>@​ddolcimascolo</code></a>
<a
href="https://github.com/markwhitfeld"><code>@​markwhitfeld</code></a>
<a
href="https://github.com/christoph-fricke"><code>@​christoph-fricke</code></a>
<a href="https://github.com/thepassle"><code>@​thepassle</code></a> <a
href="https://github.com/piotr-cz"><code>@​piotr-cz</code></a> <a
href="https://github.com/mattcosta7"><code>@​mattcosta7</code></a> <a
href="https://github.com/koddsson"><code>@​koddsson</code></a> <a
href="https://github.com/dkobierski"><code>@​dkobierski</code></a> <a
href="https://github.com/ricardocosta"><code>@​ricardocosta</code></a>
<a href="https://github.com/dxlbnl"><code>@​dxlbnl</code></a> <a
href="https://github.com/zkochan"><code>@​zkochan</code></a> <a
href="https://github.com/felipefreitag"><code>@​felipefreitag</code></a>
<a href="https://github.com/weyert"><code>@​weyert</code></a> <a
href="https://github.com/95th"><code>@​95th</code></a> <a
href="https://github.com/committomaster"><code>@​committomaster</code></a>
<a href="https://github.com/Xayer"><code>@​Xayer</code></a> <a
href="https://github.com/Kosai106"><code>@​Kosai106</code></a> <a
href="https://github.com/colinsullivan"><code>@​colinsullivan</code></a>
<a href="https://github.com/xmlking"><code>@​xmlking</code></a> <a
href="https://github.com/thw0rted"><code>@​thw0rted</code></a> <a
href="https://github.com/lee-reinhardt"><code>@​lee-reinhardt</code></a>
<a href="https://github.com/wKovacs64"><code>@​wKovacs64</code></a> <a
href="https://github.com/TeChn4K"><code>@​TeChn4K</code></a> <a
href="https://github.com/cmolina"><code>@​cmolina</code></a> <a
href="https://github.com/nickrttn"><code>@​nickrttn</code></a> <a
href="https://github.com/thomasbertet"><code>@​thomasbertet</code></a>
<a
href="https://github.com/mscottnelson"><code>@​mscottnelson</code></a>
<a href="https://github.com/jonnedeprez"><code>@​jonnedeprez</code></a>
<a href="https://github.com/negabaro"><code>@​negabaro</code></a> <a
href="https://github.com/the-ult"><code>@​the-ult</code></a> <a
href="https://github.com/WesleyYue"><code>@​WesleyYue</code></a> <a
href="https://github.com/cwagner22"><code>@​cwagner22</code></a> <a
href="https://github.com/skvale"><code>@​skvale</code></a> <a
href="https://github.com/alawiii521"><code>@​alawiii521</code></a> <a
href="https://github.com/csantos1113"><code>@​csantos1113</code></a> <a
href="https://github.com/elliotgonzalez123"><code>@​elliotgonzalez123</code></a>
<a
href="https://github.com/committomaster"><code>@​committomaster</code></a>
<a
href="https://github.com/tsteckenborn"><code>@​tsteckenborn</code></a>
<a href="https://github.com/xxleyi"><code>@​xxleyi</code></a> <a
href="https://github.com/jonnedeprez"><code>@​jonnedeprez</code></a> <a
href="https://github.com/danny-does-stuff"><code>@​danny-does-stuff</code></a>
<a href="https://github.com/lemcii"><code>@​lemcii</code></a> <a
href="https://github.com/mattrodak"><code>@​mattrodak</code></a> <a
href="https://github.com/luisr-carrillo"><code>@​luisr-carrillo</code></a>
<a
href="https://github.com/lee-reinhardt"><code>@​lee-reinhardt</code></a>
<a
href="https://github.com/ealejandrootalvaro"><code>@​ealejandrootalvaro</code></a>
<a
href="https://github.com/tomdglenn91"><code>@​tomdglenn91</code></a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/mswjs/msw/commit/873b9963de2c35832ea3f96cdb7b977d4fab9d54"><code>873b996</code></a>
chore(release): v2.0.0</li>
<li><a
href="https://github.com/mswjs/msw/commit/3ec3cc9374a280492c4684b23b853e577e33a94c"><code>3ec3cc9</code></a>
chore: remove dry release</li>
<li><a
href="https://github.com/mswjs/msw/commit/1033f651291f67a0ce509af965fdd0aa50fa7509"><code>1033f65</code></a>
feat!: adopt the global Fetch API (<a
href="https://redirect.github.com/mswjs/msw/issues/1436">#1436</a>)</li>
<li><a
href="https://github.com/mswjs/msw/commit/61c220c4ea64c192e1327f478f6961240d9fc958"><code>61c220c</code></a>
chore: set dry run release</li>
<li>See full diff in <a
href="https://github.com/mswjs/msw/compare/v1.3.2...v2.0.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=msw&package-manager=npm_and_yarn&previous-version=1.3.2&new-version=2.0.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
dependabot[bot] authored Oct 23, 2023
1 parent 6edb89f commit 2857e60
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
"happy-dom": "^12.9.0",
"intl-parse-accept-language": "^1.0.0",
"is-ip": "5.0.1",
"msw": "^1.3.2",
"msw": "^2.0.0",
"prettier": "^3.0.3",
"react": "^18.0.0",
"react-dom": "^18.0.0",
Expand Down

0 comments on commit 2857e60

Please sign in to comment.