Skip to content

feat!: msw/graphql, graphql as an optional peer dependency - #2691

Merged
kettanaito merged 24 commits into
feat/3.0from
feat/graphql-peer-dep
Jul 8, 2026
Merged

kettanaito merged 24 commits into
feat/3.0from
feat/graphql-peer-dep

Conversation

@kettanaito

@kettanaito kettanaito commented Apr 6, 2026 •

Copy link
Copy Markdown
Member

Motivation

msw leaks the graphql namespace through the root entrypoints, which makes graphql import problematic for developers who aren't even using GraphQL. This negatively impacts the bundle footprint as well.

This is a change in a set of changes aimed to improve DX and bundle size of msw across the board.

⚠️ BREAKING CHANGES

  • graphql namespace and any related values/types are no longer exported from msw. Please use a designated msw/graphql export path to work with GraphQL requests.
  • msw/core/graphql export path has been changed to msw/graphql for brevity.

Todos

@coderabbitai

coderabbitai Bot commented Apr 6, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9f090cfa-b120-42e4-ba48-7e9dd24f6909

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/graphql-peer-dep

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kettanaito
kettanaito changed the base branch from main to feat/3.0 April 6, 2026 10:48
@kettanaito kettanaito added this to the 3.0 milestone Apr 6, 2026
@kettanaito
kettanaito requested review from thepassle and removed request for thepassle April 6, 2026 10:51
@kettanaito

kettanaito commented Apr 6, 2026 •

Copy link
Copy Markdown
Member Author

@Andarist, hi 👋 Mentioning you just in case so this wouldn't conflict with the work you're doing. TL;DR msw/graphql is an explicit entrypoint now, graphql is a proper optional peer dependency. Added a new build config to tsup.config.ts. Dropped the graphqlImport plugin since there's no need to guard against those imports in the core—nothing depends on grahpql there anymore.

@kettanaito kettanaito mentioned this pull request Apr 6, 2026
2 of 8 tasks
@kettanaito kettanaito added the BREAKING CHANGE Pull request introducing breaking changes. label Apr 6, 2026
@THETCR

THETCR commented May 8, 2026

Copy link
Copy Markdown
Contributor

This is not a new feature for the end user, but a change to the auxiliary tools (dependencies etc) right?

According to conventional commits this would be the build type or refactor.

@kettanaito

Copy link
Copy Markdown
Member Author

@THETCR, this changes how you import GraphQL handlers in a breaking way. This is entirely user-facing:

-import { graphql } from 'msw'
+import { graphql } from 'msw/graphql'

As such, this will be released as a breaking change. There's no way of achieving a lean module graph without taking most of the things out of the root export.

@socket-security

socket-security Bot commented May 12, 2026 •

Copy link
Copy Markdown

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

@pkg-pr-new

pkg-pr-new Bot commented May 12, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/msw@2691

commit: adafb16

@kettanaito

Copy link
Copy Markdown
Member Author

Update

Would be nice to merge after #2760 since this PR also drops the GraphQL plugin.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
test/typings/graphql-typed-document-node.test-d.ts (1)

1-3: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Unrelated: TypedDocumentNode reverted to a value import.

Line 3 dropped the type keyword from the TypedDocumentNode import, even though it's only used in a type position (line 5). This looks like an unintended side-effect of the import-splitting edit rather than part of the GraphQL entrypoint migration. tsd only statically analyzes .test-d.ts files rather than executing them, so this won't break at runtime, but it's inconsistent with type-only usage and could cause friction if this file is ever processed under stricter compiler settings (e.g. isolatedModules/verbatimModuleSyntax).

Proposed fix
-import { TypedDocumentNode } from '`@graphql-typed-document-node/core`'
+import type { TypedDocumentNode } from '`@graphql-typed-document-node/core`'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/typings/graphql-typed-document-node.test-d.ts` around lines 1 - 3, The
TypedDocumentNode import in the graphql-typed-document-node tsd test should
remain type-only since it is only used in a type position. Update the import in
the test file to use the type modifier again, keeping the existing HttpResponse
and graphql value imports unchanged, and make sure the change is confined to the
test import setup rather than the GraphQL migration logic.
test/typings/graphql-typed-document-string.test-d.ts (1)

1-3: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Same unrelated type-import regression as graphql-typed-document-node.test-d.ts.

DocumentTypeDecoration (line 3) is used only in a type position but is no longer imported with type. Likely collateral from the mechanical import split rather than an intentional change.

Proposed fix
-import { DocumentTypeDecoration } from '`@graphql-typed-document-node/core`'
+import type { DocumentTypeDecoration } from '`@graphql-typed-document-node/core`'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/typings/graphql-typed-document-string.test-d.ts` around lines 1 - 3, The
type-only import for DocumentTypeDecoration in
graphql-typed-document-string.test-d.ts was split incorrectly, leaving it as a
value import even though it is only used in a type position. Update the import
alongside the other typings in this test file so DocumentTypeDecoration is
imported with type, matching the pattern used in
graphql-typed-document-node.test-d.ts and preserving the mechanical import split
behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@package.json`:
- Around line 126-130: Add a types condition to the ./graphql export in
package.json so the new subpath matches the other public exports and TypeScript
can resolve declarations correctly. Update the export map alongside the existing
module-sync, module, import, and default entries for the graphql subpath,
keeping the structure consistent with the other package export entries.

In `@tsup.config.ts`:
- Around line 63-79: The graphql subpath export is missing a types entry, so
TypeScript consumers cannot resolve the generated declarations. Update the
package.json export for the graphql entry to include a types condition alongside
the existing import/require targets, pointing it to the graphql declaration file
produced by graphqlConfig. Keep the existing build setup in tsup.config.ts
unchanged and align the graphql export shape with the other subpaths.

---

Nitpick comments:
In `@test/typings/graphql-typed-document-node.test-d.ts`:
- Around line 1-3: The TypedDocumentNode import in the
graphql-typed-document-node tsd test should remain type-only since it is only
used in a type position. Update the import in the test file to use the type
modifier again, keeping the existing HttpResponse and graphql value imports
unchanged, and make sure the change is confined to the test import setup rather
than the GraphQL migration logic.

In `@test/typings/graphql-typed-document-string.test-d.ts`:
- Around line 1-3: The type-only import for DocumentTypeDecoration in
graphql-typed-document-string.test-d.ts was split incorrectly, leaving it as a
value import even though it is only used in a type position. Update the import
alongside the other typings in this test file so DocumentTypeDecoration is
imported with type, matching the pattern used in
graphql-typed-document-node.test-d.ts and preserving the mechanical import split
behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4e2f807b-6c9e-44b3-ab70-d5eb8ccc52d9

📥 Commits

Reviewing files that changed from the base of the PR and between 6ada87e and 45be0cc.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (63)
  • config/plugins/esbuild/graphQLImportPlugin.ts
  • config/replaceCoreImports.js
  • package.json
  • src/core/experimental/frames/http-frame.test.ts
  • src/core/experimental/frames/websocket-frame.test.ts
  • src/core/experimental/handlers-controller.test.ts
  • src/core/handlers/RequestHandler.ts
  • src/core/index.ts
  • src/core/utils/executeHandlers.ts
  • src/core/utils/internal/isHandlerKind.test.ts
  • src/core/utils/internal/parseGraphQLRequest.test.ts
  • src/graphql/graphql-handler.test.ts
  • src/graphql/graphql-handler.ts
  • src/graphql/graphql.test.ts
  • src/graphql/graphql.ts
  • src/graphql/index.ts
  • src/graphql/parse-graphql-request.ts
  • test/browser/graphql-api/anonymous-operation.mocks.ts
  • test/browser/graphql-api/anonymous-operation.test.ts
  • test/browser/graphql-api/cookies.mocks.ts
  • test/browser/graphql-api/custom-predicate.mocks.ts
  • test/browser/graphql-api/custom-predicate.test.ts
  • test/browser/graphql-api/document-node.mocks.ts
  • test/browser/graphql-api/errors.mocks.ts
  • test/browser/graphql-api/extensions.mocks.ts
  • test/browser/graphql-api/link.mocks.ts
  • test/browser/graphql-api/logging.mocks.ts
  • test/browser/graphql-api/multipart-data.mocks.ts
  • test/browser/graphql-api/mutation.mocks.ts
  • test/browser/graphql-api/operation-reference.mocks.ts
  • test/browser/graphql-api/operation.mocks.ts
  • test/browser/graphql-api/query.mocks.ts
  • test/browser/graphql-api/response-patching.mocks.ts
  • test/browser/graphql-api/variables.mocks.ts
  • test/browser/msw-api/setup-worker/listHandlers.mocks.ts
  • test/browser/setup/webpackHttpServer.ts
  • test/node/graphql-api/anonymous-operations.test.ts
  • test/node/graphql-api/batched-queries.apollo.test.ts
  • test/node/graphql-api/batched-queries.batched-execute.test.ts
  • test/node/graphql-api/compatibility.node.test.ts
  • test/node/graphql-api/content-type.test.ts
  • test/node/graphql-api/cookies.test.ts
  • test/node/graphql-api/custom-predicate.node.test.ts
  • test/node/graphql-api/extensions.node.test.ts
  • test/node/graphql-api/response-patching.node.test.ts
  • test/node/graphql-api/typed-document-node.test.ts
  • test/node/graphql-api/typed-document-string.test.ts
  • test/node/msw-api/setup-server/listHandlers.node.test.ts
  • test/node/msw-api/setup-server/scenarios/graphql.node.test.ts
  • test/node/regressions/many-request-handlers-jsdom.test.ts
  • test/node/regressions/many-request-handlers.test.ts
  • test/node/regressions/mixed-graphql-http-with-query-in-body.node.test.ts
  • test/support/alias.ts
  • test/typings/custom-handler.test-d.ts
  • test/typings/custom-resolver.test-d.ts
  • test/typings/graphql-custom-predicate.test-d.ts
  • test/typings/graphql-typed-document-node.test-d.ts
  • test/typings/graphql-typed-document-string.test-d.ts
  • test/typings/graphql.test-d.ts
  • test/typings/regressions/request-handler-type.test-d.ts
  • test/typings/setup-server.test-d.ts
  • test/typings/setup-worker.test-d.ts
  • tsup.config.ts
💤 Files with no reviewable changes (3)
  • config/plugins/esbuild/graphQLImportPlugin.ts
  • test/browser/setup/webpackHttpServer.ts
  • src/core/index.ts

Comment thread package.json Outdated
Comment thread tsup.config.ts Outdated
@kettanaito
kettanaito marked this pull request as ready for review July 6, 2026 13:42
@kettanaito
kettanaito merged commit 00fe4e0 into feat/3.0 Jul 8, 2026
22 checks passed
@kettanaito
kettanaito deleted the feat/graphql-peer-dep branch July 8, 2026 17:31
@kettanaito kettanaito mentioned this pull request Jul 8, 2026
37 tasks done
renovate Bot added a commit to cigaleapp/cigale that referenced this pull request Oct 13, 2026
##### [v3.0.2](https://github.com/mswjs/msw/releases/tag/v3.0.2)

#### v3.0.2 (2026-10-03)

##### Bug Fixes

- **vite:** support `virtual:msw` imports in vitest ([#2802](mswjs/msw#2802)) ([`e73c381`](mswjs/msw@e73c381)) [@kettanaito](https://github.com/kettanaito)
##### [v3.0.1](https://github.com/mswjs/msw/releases/tag/v3.0.1)

#### v3.0.1 (2026-09-30)

##### Bug Fixes

- treat `CONNECT` requests as the transport mechanism ([#2796](mswjs/msw#2796)) ([`7cad86a`](mswjs/msw@7cad86a)) [@kettanaito](https://github.com/kettanaito)
##### [v3.0.0](https://github.com/mswjs/msw/releases/tag/v3.0.0)

#### v3.0.0 (2026-09-28)

- v3.0.0 ([#2692](mswjs/msw#2692)) ([`2bb4342`](mswjs/msw@2bb4342)) [@kettanaito](https://github.com/kettanaito) [@Andarist](https://github.com/Andarist)

##### ⚠️ BREAKING CHANGES

- **MSW is now ESM-only** ([#2765](mswjs/msw#2765)).
- Deprecate support for Node.js v18 and v20 ([#2729](mswjs/msw#2729)). The minimal supported Node.js version is v22.
- `msw/native` is removed in favor of [`@msw/react-native`](https://github.com/mswjs/react-native).
- Require TypeScript 5.9 as the minimal version.
- Deprecate support for TypeScript 5.1 and 5.2 ([#2730](mswjs/msw#2730))
- `worker.stop()` returns a Promise ([#2724](mswjs/msw#2724)). Awaiting it is relevant only for in-flight critical scenarios.
- `graphql` is now exported as `msw/graphql` ([#2691](mswjs/msw#2691)). GraphQL is now handled as a proper optional peer dependency.
- Removes the `handleRequest()` utility. Please use the `defineNetwork()` API instead.
- `GraphQLLinkHandlers` type has been renamed to `GraphQLLink`.
- The `file://` requests now throw in Node.js as they normally do (not supported by `fetch`).
- The `Content-Length` request header is now removed by `bypass()`.
- HTTP-to-WebSocket upgrade requests performed via `fetch()` now throw in Node.js as they normally do (not supported by `fetch`).
- Cookies are no longer managed in Node.js for better compatibilty. Instead, whatever is the default behavior of your environment that's the cookie behavior you get. This has no effect on the browser.
- WebSocket `connection` life cycle event has been renamed to `websocket:connection` ([#2783](mswjs/msw#2783)).
- `onUnhandledRequest` option has been renamed to `onUnhandledFrame`.
- The library no longer patches `setTimeout` to circumvent fake timers in test runners. You should advance the fake timers normally for delayed mocked responses to resolve.
- The library no longer returns a mocked cookie string on `request.headers.get('cookie')` in the handlers. It returns `null` in all environments. Please use the `cookies` resolver argument to have cookie-based logic.

##### Features

- Supports Node.js v24 and v26.
- Supports TypeScript v6.0 and v7.0.
- You can import individual utilities, like `delay` or `passthrough`, from the new `msw/utils` entrypoint for smaller footprint on your bundle.
- Support GraphQL v17.0.
- Support intercepting page navigations and form submissions ([#2721](mswjs/msw#2721)).
- Support GraphQL subscriptions ([#285](mswjs/msw#285), [#2763](mswjs/msw#2763)).
- Migrate from `path-to-regexp` to `@msw/url` ([#2678](mswjs/msw#2678)).
- Remove the following dependencies:
  - `graphql`
  - `path-to-regexp`
  - `picocolors`
  - `statuses`
  - `strict-event-emitter`
- Adds a Vite plugin for MSW ([#2781](mswjs/msw#2781)).
- Adds a `websocket:error` life cycle event to listen to WebSocket connection errors ([#2784](mswjs/msw#2784)).
- Support modifying the intercepted request headers in passthrough scenarios ([#2786](mswjs/msw#2786)).
- Support a new WebSocket Extension API that allows for better custom experiences ([#2791](mswjs/msw#2791)).

##### Bug fixes

- Fix an issue where preventing a page closure via the `beforeunload` listener would unregister the MSW worker ([#1105](mswjs/msw#1105)).
- Fix an issue that caused intermittent test failures in Vitest Browser Mode and Firefox if using `maxWorkers: 1` ([#2726](mswjs/msw#2726)).
- Fix an issue where in-flight requests were incorrectly passthrough when performed before calling `worker.stop()` ([#2724](mswjs/msw#2724), [#2597](mswjs/msw#2597)).
- Fix an issue where persisting cookies in `localStorage` would cause a maximum quota exceeded errors.
- Fix various issues related to the network interception in Node.js.
renovate Bot added a commit to cigaleapp/cigale that referenced this pull request Oct 17, 2026
##### [v3.0.3](https://github.com/mswjs/msw/releases/tag/v3.0.3)

#### v3.0.3 (2026-10-10)

##### Bug Fixes

- **HandlersController:** dispose of reset handlers ([#2810](mswjs/msw#2810)) ([`3818a81`](mswjs/msw@3818a81)) [@kettanaito](https://github.com/kettanaito)
- expose network context on `enable` in network sources ([#2809](mswjs/msw#2809)) ([`d1fe8e6`](mswjs/msw@d1fe8e6)) [@kettanaito](https://github.com/kettanaito)
##### [v3.0.2](https://github.com/mswjs/msw/releases/tag/v3.0.2)

#### v3.0.2 (2026-10-03)

##### Bug Fixes

- **vite:** support `virtual:msw` imports in vitest ([#2802](mswjs/msw#2802)) ([`e73c381`](mswjs/msw@e73c381)) [@kettanaito](https://github.com/kettanaito)
##### [v3.0.1](https://github.com/mswjs/msw/releases/tag/v3.0.1)

#### v3.0.1 (2026-09-30)

##### Bug Fixes

- treat `CONNECT` requests as the transport mechanism ([#2796](mswjs/msw#2796)) ([`7cad86a`](mswjs/msw@7cad86a)) [@kettanaito](https://github.com/kettanaito)
##### [v3.0.0](https://github.com/mswjs/msw/releases/tag/v3.0.0)

#### v3.0.0 (2026-09-28)

- v3.0.0 ([#2692](mswjs/msw#2692)) ([`2bb4342`](mswjs/msw@2bb4342)) [@kettanaito](https://github.com/kettanaito) [@Andarist](https://github.com/Andarist)

##### ⚠️ BREAKING CHANGES

- **MSW is now ESM-only** ([#2765](mswjs/msw#2765)).
- Deprecate support for Node.js v18 and v20 ([#2729](mswjs/msw#2729)). The minimal supported Node.js version is v22.
- `msw/native` is removed in favor of [`@msw/react-native`](https://github.com/mswjs/react-native).
- Require TypeScript 5.9 as the minimal version.
- Deprecate support for TypeScript 5.1 and 5.2 ([#2730](mswjs/msw#2730))
- `worker.stop()` returns a Promise ([#2724](mswjs/msw#2724)). Awaiting it is relevant only for in-flight critical scenarios.
- `graphql` is now exported as `msw/graphql` ([#2691](mswjs/msw#2691)). GraphQL is now handled as a proper optional peer dependency.
- Removes the `handleRequest()` utility. Please use the `defineNetwork()` API instead.
- `GraphQLLinkHandlers` type has been renamed to `GraphQLLink`.
- The `file://` requests now throw in Node.js as they normally do (not supported by `fetch`).
- The `Content-Length` request header is now removed by `bypass()`.
- HTTP-to-WebSocket upgrade requests performed via `fetch()` now throw in Node.js as they normally do (not supported by `fetch`).
- Cookies are no longer managed in Node.js for better compatibility. Instead, whatever is the default behavior of your environment that's the cookie behavior you get. This has no effect on the browser.
- WebSocket `connection` life cycle event has been renamed to `websocket:connection` ([#2783](mswjs/msw#2783)).
- `onUnhandledRequest` option has been renamed to `onUnhandledFrame`.
- The library no longer patches `setTimeout` to circumvent fake timers in test runners. You should advance the fake timers normally for delayed mocked responses to resolve.
- The library no longer returns a mocked cookie string on `request.headers.get('cookie')` in the handlers. It returns `null` in all environments. Please use the `cookies` resolver argument to have cookie-based logic.

##### Features

- Supports Node.js v24 and v26.
- Supports TypeScript v6.0 and v7.0.
- You can import individual utilities, like `delay` or `passthrough`, from the new `msw/utils` entrypoint for smaller footprint on your bundle.
- Support GraphQL v17.0.
- Support intercepting page navigations and form submissions ([#2721](mswjs/msw#2721)).
- Support GraphQL subscriptions ([#285](mswjs/msw#285), [#2763](mswjs/msw#2763)).
- Migrate from `path-to-regexp` to `@msw/url` ([#2678](mswjs/msw#2678)).
- Remove the following dependencies:
  - `graphql`
  - `path-to-regexp`
  - `picocolors`
  - `statuses`
  - `strict-event-emitter`
- Adds a Vite plugin for MSW ([#2781](mswjs/msw#2781)).
- Adds a `websocket:error` life cycle event to listen to WebSocket connection errors ([#2784](mswjs/msw#2784)).
- Support modifying the intercepted request headers in passthrough scenarios ([#2786](mswjs/msw#2786)).
- Support a new WebSocket Extension API that allows for better custom experiences ([#2791](mswjs/msw#2791)).

##### Bug fixes

- Fix an issue where preventing a page closure via the `beforeunload` listener would unregister the MSW worker ([#1105](mswjs/msw#1105)).
- Fix an issue that caused intermittent test failures in Vitest Browser Mode and Firefox if using `maxWorkers: 1` ([#2726](mswjs/msw#2726)).
- Fix an issue where in-flight requests were incorrectly passthrough when performed before calling `worker.stop()` ([#2724](mswjs/msw#2724), [#2597](mswjs/msw#2597)).
- Fix an issue where persisting cookies in `localStorage` would cause a maximum quota exceeded errors.
- Fix various issues related to the network interception in Node.js.
renovate Bot added a commit to cigaleapp/cigale that referenced this pull request Oct 20, 2026
##### [v3.0.3](https://github.com/mswjs/msw/releases/tag/v3.0.3)

#### v3.0.3 (2026-10-10)

##### Bug Fixes

- **HandlersController:** dispose of reset handlers ([#2810](mswjs/msw#2810)) ([`3818a81`](mswjs/msw@3818a81)) [@kettanaito](https://github.com/kettanaito)
- expose network context on `enable` in network sources ([#2809](mswjs/msw#2809)) ([`d1fe8e6`](mswjs/msw@d1fe8e6)) [@kettanaito](https://github.com/kettanaito)
##### [v3.0.2](https://github.com/mswjs/msw/releases/tag/v3.0.2)

#### v3.0.2 (2026-10-03)

##### Bug Fixes

- **vite:** support `virtual:msw` imports in vitest ([#2802](mswjs/msw#2802)) ([`e73c381`](mswjs/msw@e73c381)) [@kettanaito](https://github.com/kettanaito)
##### [v3.0.1](https://github.com/mswjs/msw/releases/tag/v3.0.1)

#### v3.0.1 (2026-09-30)

##### Bug Fixes

- treat `CONNECT` requests as the transport mechanism ([#2796](mswjs/msw#2796)) ([`7cad86a`](mswjs/msw@7cad86a)) [@kettanaito](https://github.com/kettanaito)
##### [v3.0.0](https://github.com/mswjs/msw/releases/tag/v3.0.0)

#### v3.0.0 (2026-09-28)

- v3.0.0 ([#2692](mswjs/msw#2692)) ([`2bb4342`](mswjs/msw@2bb4342)) [@kettanaito](https://github.com/kettanaito) [@Andarist](https://github.com/Andarist)

##### ⚠️ BREAKING CHANGES

- **MSW is now ESM-only** ([#2765](mswjs/msw#2765)).
- Deprecate support for Node.js v18 and v20 ([#2729](mswjs/msw#2729)). The minimal supported Node.js version is v22.
- `msw/native` is removed in favor of [`@msw/react-native`](https://github.com/mswjs/react-native).
- Require TypeScript 5.9 as the minimal version.
- Deprecate support for TypeScript 5.1 and 5.2 ([#2730](mswjs/msw#2730))
- `worker.stop()` returns a Promise ([#2724](mswjs/msw#2724)). Awaiting it is relevant only for in-flight critical scenarios.
- `graphql` is now exported as `msw/graphql` ([#2691](mswjs/msw#2691)). GraphQL is now handled as a proper optional peer dependency.
- Removes the `handleRequest()` utility. Please use the `defineNetwork()` API instead.
- `GraphQLLinkHandlers` type has been renamed to `GraphQLLink`.
- The `file://` requests now throw in Node.js as they normally do (not supported by `fetch`).
- The `Content-Length` request header is now removed by `bypass()`.
- HTTP-to-WebSocket upgrade requests performed via `fetch()` now throw in Node.js as they normally do (not supported by `fetch`).
- Cookies are no longer managed in Node.js for better compatibility. Instead, whatever is the default behavior of your environment that's the cookie behavior you get. This has no effect on the browser.
- WebSocket `connection` life cycle event has been renamed to `websocket:connection` ([#2783](mswjs/msw#2783)).
- `onUnhandledRequest` option has been renamed to `onUnhandledFrame`.
- The library no longer patches `setTimeout` to circumvent fake timers in test runners. You should advance the fake timers normally for delayed mocked responses to resolve.
- The library no longer returns a mocked cookie string on `request.headers.get('cookie')` in the handlers. It returns `null` in all environments. Please use the `cookies` resolver argument to have cookie-based logic.

##### Features

- Supports Node.js v24 and v26.
- Supports TypeScript v6.0 and v7.0.
- You can import individual utilities, like `delay` or `passthrough`, from the new `msw/utils` entrypoint for smaller footprint on your bundle.
- Support GraphQL v17.0.
- Support intercepting page navigations and form submissions ([#2721](mswjs/msw#2721)).
- Support GraphQL subscriptions ([#285](mswjs/msw#285), [#2763](mswjs/msw#2763)).
- Migrate from `path-to-regexp` to `@msw/url` ([#2678](mswjs/msw#2678)).
- Remove the following dependencies:
  - `graphql`
  - `path-to-regexp`
  - `picocolors`
  - `statuses`
  - `strict-event-emitter`
- Adds a Vite plugin for MSW ([#2781](mswjs/msw#2781)).
- Adds a `websocket:error` life cycle event to listen to WebSocket connection errors ([#2784](mswjs/msw#2784)).
- Support modifying the intercepted request headers in passthrough scenarios ([#2786](mswjs/msw#2786)).
- Support a new WebSocket Extension API that allows for better custom experiences ([#2791](mswjs/msw#2791)).

##### Bug fixes

- Fix an issue where preventing a page closure via the `beforeunload` listener would unregister the MSW worker ([#1105](mswjs/msw#1105)).
- Fix an issue that caused intermittent test failures in Vitest Browser Mode and Firefox if using `maxWorkers: 1` ([#2726](mswjs/msw#2726)).
- Fix an issue where in-flight requests were incorrectly passthrough when performed before calling `worker.stop()` ([#2724](mswjs/msw#2724), [#2597](mswjs/msw#2597)).
- Fix an issue where persisting cookies in `localStorage` would cause a maximum quota exceeded errors.
- Fix various issues related to the network interception in Node.js.
renovate Bot added a commit to cigaleapp/cigale that referenced this pull request Oct 22, 2026
##### [v3.0.3](https://github.com/mswjs/msw/releases/tag/v3.0.3)

#### v3.0.3 (2026-10-10)

##### Bug Fixes

- **HandlersController:** dispose of reset handlers ([#2810](mswjs/msw#2810)) ([`3818a81`](mswjs/msw@3818a81)) [@kettanaito](https://github.com/kettanaito)
- expose network context on `enable` in network sources ([#2809](mswjs/msw#2809)) ([`d1fe8e6`](mswjs/msw@d1fe8e6)) [@kettanaito](https://github.com/kettanaito)
##### [v3.0.2](https://github.com/mswjs/msw/releases/tag/v3.0.2)

#### v3.0.2 (2026-10-03)

##### Bug Fixes

- **vite:** support `virtual:msw` imports in vitest ([#2802](mswjs/msw#2802)) ([`e73c381`](mswjs/msw@e73c381)) [@kettanaito](https://github.com/kettanaito)
##### [v3.0.1](https://github.com/mswjs/msw/releases/tag/v3.0.1)

#### v3.0.1 (2026-09-30)

##### Bug Fixes

- treat `CONNECT` requests as the transport mechanism ([#2796](mswjs/msw#2796)) ([`7cad86a`](mswjs/msw@7cad86a)) [@kettanaito](https://github.com/kettanaito)
##### [v3.0.0](https://github.com/mswjs/msw/releases/tag/v3.0.0)

#### v3.0.0 (2026-09-28)

- v3.0.0 ([#2692](mswjs/msw#2692)) ([`2bb4342`](mswjs/msw@2bb4342)) [@kettanaito](https://github.com/kettanaito) [@Andarist](https://github.com/Andarist)

##### ⚠️ BREAKING CHANGES

- **MSW is now ESM-only** ([#2765](mswjs/msw#2765)).
- Deprecate support for Node.js v18 and v20 ([#2729](mswjs/msw#2729)). The minimal supported Node.js version is v22.
- `msw/native` is removed in favor of [`@msw/react-native`](https://github.com/mswjs/react-native).
- Require TypeScript 5.9 as the minimal version.
- Deprecate support for TypeScript 5.1 and 5.2 ([#2730](mswjs/msw#2730))
- `worker.stop()` returns a Promise ([#2724](mswjs/msw#2724)). Awaiting it is relevant only for in-flight critical scenarios.
- `graphql` is now exported as `msw/graphql` ([#2691](mswjs/msw#2691)). GraphQL is now handled as a proper optional peer dependency.
- Removes the `handleRequest()` utility. Please use the `defineNetwork()` API instead.
- `GraphQLLinkHandlers` type has been renamed to `GraphQLLink`.
- The `file://` requests now throw in Node.js as they normally do (not supported by `fetch`).
- The `Content-Length` request header is now removed by `bypass()`.
- HTTP-to-WebSocket upgrade requests performed via `fetch()` now throw in Node.js as they normally do (not supported by `fetch`).
- Cookies are no longer managed in Node.js for better compatibility. Instead, whatever is the default behavior of your environment that's the cookie behavior you get. This has no effect on the browser.
- WebSocket `connection` life cycle event has been renamed to `websocket:connection` ([#2783](mswjs/msw#2783)).
- `onUnhandledRequest` option has been renamed to `onUnhandledFrame`.
- The library no longer patches `setTimeout` to circumvent fake timers in test runners. You should advance the fake timers normally for delayed mocked responses to resolve.
- The library no longer returns a mocked cookie string on `request.headers.get('cookie')` in the handlers. It returns `null` in all environments. Please use the `cookies` resolver argument to have cookie-based logic.

##### Features

- Supports Node.js v24 and v26.
- Supports TypeScript v6.0 and v7.0.
- You can import individual utilities, like `delay` or `passthrough`, from the new `msw/utils` entrypoint for smaller footprint on your bundle.
- Support GraphQL v17.0.
- Support intercepting page navigations and form submissions ([#2721](mswjs/msw#2721)).
- Support GraphQL subscriptions ([#285](mswjs/msw#285), [#2763](mswjs/msw#2763)).
- Migrate from `path-to-regexp` to `@msw/url` ([#2678](mswjs/msw#2678)).
- Remove the following dependencies:
  - `graphql`
  - `path-to-regexp`
  - `picocolors`
  - `statuses`
  - `strict-event-emitter`
- Adds a Vite plugin for MSW ([#2781](mswjs/msw#2781)).
- Adds a `websocket:error` life cycle event to listen to WebSocket connection errors ([#2784](mswjs/msw#2784)).
- Support modifying the intercepted request headers in passthrough scenarios ([#2786](mswjs/msw#2786)).
- Support a new WebSocket Extension API that allows for better custom experiences ([#2791](mswjs/msw#2791)).

##### Bug fixes

- Fix an issue where preventing a page closure via the `beforeunload` listener would unregister the MSW worker ([#1105](mswjs/msw#1105)).
- Fix an issue that caused intermittent test failures in Vitest Browser Mode and Firefox if using `maxWorkers: 1` ([#2726](mswjs/msw#2726)).
- Fix an issue where in-flight requests were incorrectly passthrough when performed before calling `worker.stop()` ([#2724](mswjs/msw#2724), [#2597](mswjs/msw#2597)).
- Fix an issue where persisting cookies in `localStorage` would cause a maximum quota exceeded errors.
- Fix various issues related to the network interception in Node.js.
renovate Bot added a commit to cigaleapp/cigale that referenced this pull request Oct 26, 2026
##### [v3.0.3](https://github.com/mswjs/msw/releases/tag/v3.0.3)

#### v3.0.3 (2026-10-10)

##### Bug Fixes

- **HandlersController:** dispose of reset handlers ([#2810](mswjs/msw#2810)) ([`3818a81`](mswjs/msw@3818a81)) [@kettanaito](https://github.com/kettanaito)
- expose network context on `enable` in network sources ([#2809](mswjs/msw#2809)) ([`d1fe8e6`](mswjs/msw@d1fe8e6)) [@kettanaito](https://github.com/kettanaito)
##### [v3.0.2](https://github.com/mswjs/msw/releases/tag/v3.0.2)

#### v3.0.2 (2026-10-03)

##### Bug Fixes

- **vite:** support `virtual:msw` imports in vitest ([#2802](mswjs/msw#2802)) ([`e73c381`](mswjs/msw@e73c381)) [@kettanaito](https://github.com/kettanaito)
##### [v3.0.1](https://github.com/mswjs/msw/releases/tag/v3.0.1)

#### v3.0.1 (2026-09-30)

##### Bug Fixes

- treat `CONNECT` requests as the transport mechanism ([#2796](mswjs/msw#2796)) ([`7cad86a`](mswjs/msw@7cad86a)) [@kettanaito](https://github.com/kettanaito)
##### [v3.0.0](https://github.com/mswjs/msw/releases/tag/v3.0.0)

#### v3.0.0 (2026-09-28)

- v3.0.0 ([#2692](mswjs/msw#2692)) ([`2bb4342`](mswjs/msw@2bb4342)) [@kettanaito](https://github.com/kettanaito) [@Andarist](https://github.com/Andarist)

##### ⚠️ BREAKING CHANGES

- **MSW is now ESM-only** ([#2765](mswjs/msw#2765)).
- Deprecate support for Node.js v18 and v20 ([#2729](mswjs/msw#2729)). The minimal supported Node.js version is v22.
- `msw/native` is removed in favor of [`@msw/react-native`](https://github.com/mswjs/react-native).
- Require TypeScript 5.9 as the minimal version.
- Deprecate support for TypeScript 5.1 and 5.2 ([#2730](mswjs/msw#2730))
- `worker.stop()` returns a Promise ([#2724](mswjs/msw#2724)). Awaiting it is relevant only for in-flight critical scenarios.
- `graphql` is now exported as `msw/graphql` ([#2691](mswjs/msw#2691)). GraphQL is now handled as a proper optional peer dependency.
- Removes the `handleRequest()` utility. Please use the `defineNetwork()` API instead.
- `GraphQLLinkHandlers` type has been renamed to `GraphQLLink`.
- The `file://` requests now throw in Node.js as they normally do (not supported by `fetch`).
- The `Content-Length` request header is now removed by `bypass()`.
- HTTP-to-WebSocket upgrade requests performed via `fetch()` now throw in Node.js as they normally do (not supported by `fetch`).
- Cookies are no longer managed in Node.js for better compatibility. Instead, whatever is the default behavior of your environment that's the cookie behavior you get. This has no effect on the browser.
- WebSocket `connection` life cycle event has been renamed to `websocket:connection` ([#2783](mswjs/msw#2783)).
- `onUnhandledRequest` option has been renamed to `onUnhandledFrame`.
- The library no longer patches `setTimeout` to circumvent fake timers in test runners. You should advance the fake timers normally for delayed mocked responses to resolve.
- The library no longer returns a mocked cookie string on `request.headers.get('cookie')` in the handlers. It returns `null` in all environments. Please use the `cookies` resolver argument to have cookie-based logic.

##### Features

- Supports Node.js v24 and v26.
- Supports TypeScript v6.0 and v7.0.
- You can import individual utilities, like `delay` or `passthrough`, from the new `msw/utils` entrypoint for smaller footprint on your bundle.
- Support GraphQL v17.0.
- Support intercepting page navigations and form submissions ([#2721](mswjs/msw#2721)).
- Support GraphQL subscriptions ([#285](mswjs/msw#285), [#2763](mswjs/msw#2763)).
- Migrate from `path-to-regexp` to `@msw/url` ([#2678](mswjs/msw#2678)).
- Remove the following dependencies:
  - `graphql`
  - `path-to-regexp`
  - `picocolors`
  - `statuses`
  - `strict-event-emitter`
- Adds a Vite plugin for MSW ([#2781](mswjs/msw#2781)).
- Adds a `websocket:error` life cycle event to listen to WebSocket connection errors ([#2784](mswjs/msw#2784)).
- Support modifying the intercepted request headers in passthrough scenarios ([#2786](mswjs/msw#2786)).
- Support a new WebSocket Extension API that allows for better custom experiences ([#2791](mswjs/msw#2791)).

##### Bug fixes

- Fix an issue where preventing a page closure via the `beforeunload` listener would unregister the MSW worker ([#1105](mswjs/msw#1105)).
- Fix an issue that caused intermittent test failures in Vitest Browser Mode and Firefox if using `maxWorkers: 1` ([#2726](mswjs/msw#2726)).
- Fix an issue where in-flight requests were incorrectly passthrough when performed before calling `worker.stop()` ([#2724](mswjs/msw#2724), [#2597](mswjs/msw#2597)).
- Fix an issue where persisting cookies in `localStorage` would cause a maximum quota exceeded errors.
- Fix various issues related to the network interception in Node.js.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BREAKING CHANGE Pull request introducing breaking changes. release candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants