msw
npmv2.15.0TypeScriptSeamless 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.
Runtime packages this one declares itself.
Distinct packages in the full runtime tree, deduplicated the way a package manager would.
Unpacked size of this package plus its entire runtime tree.
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
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',msw vs the alternatives
Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.
| Package | Weekly downloads | Dependents | License | Last release |
|---|---|---|---|---|
| mswthis page | 0 | 5 | MIT | 2 months ago |
| jest | 42.1M | 70 | MIT | 1 day ago |
| next | 40.6M | 0 | MIT | 1 day ago |
| @mswjs/interceptors | 20.3M | 1 | MIT | 1 day ago |
| @jest/core | 0 | 2 | MIT | 1 day ago |
| jest-cli | 0 | 3 | MIT | 1 day ago |
Dependencies
Declared by msw v2.15.0. Runtime dependencies are installed with the package; dev dependencies are not.
Runtime (18)
Peer (1)
Dev (44)
Used by
Popular packages that depend on msw.
The official, opinionated, batteries-included toolset for efficient Redux development
libSQL driver for TypeScript and JavaScript
Vitest module mocker implementation
Seamless REST/GraphQL API mocking library for browser and Node.js.
Web framework built on Web Standards
Relationship graph
Dependencies (left) and dependents (right) of msw.
Frequently installed together
Prettier is an opinionated code formatter
TypeScript definitions for node
An extremely fast JavaScript and CSS bundler and minifier.
Next generation testing framework powered by Vite
A JavaScript implementation of many web standards
An AST-based pattern checker for JavaScript.
TypeScript-first schema declaration and validation library with static type inference
V8 coverage provider for Vitest
Type definitions and documentation for Bun, an incredibly fast JavaScript runtime
TypeScript definitions for ws
Node.js Adapter for Hono
Native-ESM powered web dev build tool
Release history
50 releases in the last two years, typically about 3 days apart.
| Version | Published | Size | License |
|---|---|---|---|
| 2.15.0latest | 2 months ago | 5.8 MB | MIT |
| 2.14.7 | 2 months ago | 5.7 MB | MIT |
| 2.14.6 | 4 months ago | 5.3 MB | MIT |
| 2.14.5 | 4 months ago | 5.3 MB | MIT |
| 2.14.4 | 4 months ago | 5.3 MB | MIT |
| 2.14.3 | 4 months ago | 5.3 MB | MIT |
| 2.14.2 | 4 months ago | 5.3 MB | MIT |
| 2.14.1 | 4 months ago | 5.3 MB | MIT |
| 2.14.0 | 4 months ago | 5.3 MB | MIT |
| 2.13.6 | 4 months ago | 5.2 MB | MIT |
| 2.13.5 | 4 months ago | 5.2 MB | MIT |
| 2.13.4 | 4 months ago | 5.2 MB | MIT |
| 2.13.3 | 4 months ago | 5.1 MB | MIT |
| 2.13.2 | 5 months ago | 5.1 MB | MIT |
| 2.13.1 | 5 months ago | 5.1 MB | MIT |
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
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.