</>PackageGraphPackageGraph

msw

npmv2.15.0TypeScript

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

Adopt with care

msw is usable, with caveats. Pulls in 37 transitive packages, about 18 MB installed (at least — some of the tree is still being crawled). This package runs an install script on your machine, has a single maintainer (bus factor of 1).

  • ?Adoption: grade ?, Not reported by this registry.

    No download data reported for this package yet.

  • AMaintenance: grade A, Excellent.

    Last published 64 days ago. 50 releases in the last 2 years.

  • CWeight: grade C, Fair — worth a look.

    Pulls in 37 transitive packages, about 18 MB installed (at least — some of the tree is still being crawled).

  • CSupply chain: grade C, Fair — worth a look.

    This package runs an install script on your machine, has a single maintainer (bus factor of 1).

  • ALicense: grade A, Excellent.

    MIT — permissive, with no copyleft found in the dependency tree.

Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.

Install cost

What you actually take on by adding msw to a project.

18
Direct dependencies

Runtime packages this one declares itself.

37
Total installed

Distinct packages in the full runtime tree, deduplicated the way a package manager would.

18 MB
Install size

Unpacked size of this package plus its entire runtime tree.

4
Tree depth

Longest resolved dependency chain below this package.

Part of this dependency tree has not been crawled yet, so these figures are a lower bound rather than a final total.

Licenses in the dependency tree

(MIT OR CC0-1.0)ISCMIT

Every license you inherit by installing msw, not just its own. Check this before a legal review, not after.

Compatibility

Node.js
node >=18
Module format
ESM + CommonJS
TypeScript
Types included
Install scripts
Runs on install

Installing this package executes a script defined by its publisher. That is normal for native modules, but it is also how supply-chain attacks run — review it before installing in CI or on a machine with credentials.

Quick start

A usage example from the msw README.

// 1. Import the library.
import { http, HttpResponse } from 'msw'
import { setupWorker } from 'msw/browser'

// 2. Describe network behavior with request handlers.
const worker = setupWorker(
  http.get('https://github.com/octocat', ({ request, params, cookies }) => {
    return HttpResponse.json(
      {
        message: 'Mocked response',
      },
      {
        status: 202,
        statusText: 'Mocked status',
Example truncated — see the full README.

msw vs the alternatives

Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.

PackageWeekly downloadsDependentsLicenseLast release
mswthis page05MIT2 months ago
jest42.1M70MIT1 day ago
next40.6M0MIT1 day ago
@mswjs/interceptors20.3M1MIT1 day ago
@jest/core02MIT1 day ago
jest-cli03MIT1 day ago

Dependencies

Declared by msw v2.15.0. Runtime dependencies are installed with the package; dev dependencies are not.

Peer (1)

typescript >= 4.8.x

Dev (44)

@commitlint/cli ^20.5.0@commitlint/config-conventional ^20.5.0@epic-web/test-server ^0.1.6@fastify/websocket ^11.2.0@graphql-typed-document-node/core ^3.2.0@open-draft/test-server ^0.4.2@ossjs/release ^0.11.1@playwright/test ^1.59.1@types/express ^5.0.6@types/json-bigint ^1.0.4@types/node ~22.19.17@types/serviceworker ^0.0.194@web/dev-server ^0.4.6axios ^1.15.0babel-minify ^0.5.1commitizen ^4.3.1cross-env ^10.1.0cross-fetch ^4.1.0cz-conventional-changelog 3.3.0esbuild ^0.28.0esbuild-loader ^4.4.3express ^5.2.1fastify ^5.8.5fs-teardown ^0.3.0glob ^13.0.6jsdom ^25.0.1json-bigint ^1.0.0knip ^6.4.1lint-staged ^16.4.0msw ^2.15.0oxlint ^1.0.0page-with ^0.6.1prettier ^3.8.3publint ^0.3.18regenerator-runtime ^0.14.1rimraf ^6.1.3simple-git-hooks ^2.13.1tsup ^8.5.1typescript ^5.9.3undici ^7.28.0url-loader ^4.1.1vitest ^4.1.4webpack ^5.106.2webpack-http-server ^0.5.0

Used by

Popular packages that depend on msw.

Relationship graph

Dependencies (left) and dependents (right) of msw.

Frequently installed together

Release history

50 releases in the last two years, typically about 3 days apart.

Recent versions of msw
VersionPublishedSizeLicense
2.15.0latest2 months ago5.8 MBMIT
2.14.72 months ago5.7 MBMIT
2.14.64 months ago5.3 MBMIT
2.14.54 months ago5.3 MBMIT
2.14.44 months ago5.3 MBMIT
2.14.34 months ago5.3 MBMIT
2.14.24 months ago5.3 MBMIT
2.14.14 months ago5.3 MBMIT
2.14.04 months ago5.3 MBMIT
2.13.64 months ago5.2 MBMIT
2.13.54 months ago5.2 MBMIT
2.13.44 months ago5.2 MBMIT
2.13.34 months ago5.1 MBMIT
2.13.25 months ago5.1 MBMIT
2.13.15 months ago5.1 MBMIT

Overview

msw is an npm package that seamless REST/GraphQL API mocking library for browser and Node.js. It has 5 known dependents in the graph. The latest version is 2.15.0, released under the MIT license.

Who should use it

Teams working in the npm ecosystem who need seamless REST/GraphQL API mocking library for browser and Node.js and value a focused solution.

When not to use it

Consider an alternative if you need to minimize your dependency tree, or if a more actively-maintained option better fits your npm stack.

Pros

  • Ships TypeScript type definitions.
  • Clear open-source license (MIT).

Cons

  • Large dependency tree (63 direct dependencies) increases install size and audit surface.

Auto-generated from collected registry metadata. No external claims are inferred.

Maintainers

Keywords

Funding

Frequently asked questions

Should I use msw?

msw is usable, with caveats. Pulls in 37 transitive packages, about 18 MB installed (at least — some of the tree is still being crawled). This package runs an install script on your machine, has a single maintainer (bus factor of 1).

How do I install msw?

Run `npm install msw` to add msw to your npm project.

How many dependencies does msw have?

msw declares 63 direct dependencies and pulls in 37 packages in total once its runtime tree is resolved totalling about 18 MB on disk.

What license is msw released under?

msw is distributed under the MIT license. Its dependency tree also includes: (MIT OR CC0-1.0), ISC, MIT.

How popular is msw?

npm does not publish download counts. Within PackageGraph's crawl, 5 known packages depend on msw.

Is msw still maintained?

The most recent release of msw (v2.15.0) was published 2 months ago.

Does msw run install scripts?

Yes. msw defines a lifecycle script that executes when the package is installed. Review it before installing in CI or on a machine holding credentials.