Mock Service Worker (MSW) is an API mocking library for JavaScript that intercepts requests and returns mock responses. It helps developers test and develop against consistent network behavior without stubbing application code, with support for both browser (via Service Worker) and Node.js (via request interception).
Project status
- Actively maintained: The repository shows recent tagged updates in May 2026 (v2.14.4 to v2.14.6), with bug fixes and new API work continuing.
- Update cadence: Recent updates are close together (v2.14.4 on 2026-05-07, v2.14.5 on 2026-05-08, v2.14.6 on 2026-05-11), suggesting an active, roughly week-level cadence (at least in this window).
AI summary generated Today
Recent updates
v2.14.6
3 weeks agov2.14.6 includes a fix in `defineNetwork` to prevent previously-attached frame event listeners from forwarding events across enable/disable cycles. The release notes describe the intent, but the code introduces additional behavioral changes in how listeners are cleaned up and how dispose-time errors are handled.
v2.14.5
1 month agov2.14.5 is a small bug fix release focused on WebSocket behavior during client shutdown. It adds cleanup logic so frame-related event listeners are removed when the client WebSocket connection closes.
v2.14.4
1 month agov2.14.4 introduces a new `finalize` callback API for request handlers, intended to let developers schedule cleanup logic that runs after the handler finishes. The change is implemented in the core `RequestHandler` execution flow and is covered by new Node-focused tests and updated TypeScript typing tests.
Featuresv2.14.3
1 month agov2.14.3 primarily addresses a memory leak related to per-request frame abort listener cleanup. The implementation now aggressively removes event emitter listeners from frames after emitting the response, and adds a dedicated heap snapshot based memory test suite.
v2.14.2
1 month agov2.14.2 makes a small change related to public type exports in the experimental core API. The release notes describe exporting the `NetworkApi` type, and the code diff shows that new type is re-exported from `src/core/experimental/index.ts`.
v2.14.1
1 month agov2.14.1 is a small maintenance release that adds new public exports for handler controller classes. The change appears limited to the library's index files, plus a version bump in package.json.
v2.14.0
1 month agov2.14.0 adds support for handling WebSocket connection upgrades via a new `ws.onUpgrade` implementation, including an HTTP Upgrade flow that returns a 101 response with the correct `Sec-WebSocket-Accept` value. It also fixes cookie forwarding behavior and avoids cloning user-provided responses when producing the final mocked response.
Featuresv2.13.6
1 month agov2.13.6 mainly introduces a new public `WebSocketHandler.test()` method and extends internal URL matching utilities. The release notes only mention the new `test()` method, but the actual diff also changes the TypeScript signatures of other public methods on `WebSocketHandler`.
v2.13.5
1 month agov2.13.5 primarily addresses handler reset behavior for generator-based response resolvers. The code changes implement a more comprehensive handler state reset and restore mechanism (not just toggling an isUsed flag), and they add new internal tests to verify generator state cleanup.
v2.13.4
1 month agov2.13.4 is a bug fix release focused on stabilizing ServiceWorker-based mocking and improving Server-Sent Events (SSE) cancellation behavior. It introduces a proper singleton pattern for ServiceWorkerSource and refactors SSE handling to respect request.signal, while also cleaning up exports to be consistent with verbatimModuleSyntax.