Skip to content
PluginStats

msw-request-assertions weekly downloads statistics

By marklai1998 · npm · Testing

Request assertions for MSW

View on npm Fresh · Oct 17, 2026

msw-request-assertions has 374 recorded weekly downloads on npm, an increase of 41.1% over the past 30 days.

It ranks #1524 of 2,251 tracked npm listings by weekly downloads.

Over 90 days, weekly downloads changed by +40.1%.

PluginStats has 543 daily observations since Apr 23, 2025; the latest is from Oct 17, 2026.

Weekly downloads
374
Official API · Oct 17, 2026
7-day growth
-9.7%
-40 weekly downloads
30-day growth
+41.1%
+109 weekly downloads
90-day growth
+40.1%
+107 weekly downloads
Rank
#1524
Among tracked npm listings

About msw-request-assertions

MSW Request Assertions

A powerful testing library that provides custom assertion matchers for Mock Service Worker (MSW). Test your API interactions with confidence by asserting on request properties like headers, body, query parameters, and more.

Features | Installation | Migration | API | Contributing

[!IMPORTANT] Before using this library, please read MSW's official guidance on avoiding request assertions. The MSW team recommends testing how your application reacts to requests rather than asserting on request details. This library should primarily be used for edge cases, like request details have no observable application behavior.

✨ Features

• ✅ Assert on any aspect of HTTP and GraphQL requests • ✅ Works with Vitest and Jest

📦 Installation

🚀 Quick Start

Setup for Vitest

msw-request-assertions/vitest ships Vitest 5 matcher types (Matchers).

Vitest 4: use msw-request-assertions/vitest/v4 instead. See Migration.

Setup for Jest

[!NOTE] Jest support is not a first-class citizen due to complex setup requirements between ESM and CJS modules. While we provide Jest compatibility, our main development and testing efforts are focused on Vitest. Feel free to raise an issue if you encounter Jest-specific problems.

Basic Example

🔄 Migration

Vitest 5 matcher types (breaking)

Default msw-request-assertions/vitest types now match Vitest 5:

Vitest 4's Matchers is a different type-parameter list. TypeScript cannot merge both in one declaration (TS2428).

Vitest 5: keep the existing import. No code change.

Vitest 4: switch the setup import and tsconfig types entry to /vitest/v4. Runtime is the same.

Do not import both /vitest and /vitest/v4 in the same TypeScript project.

💻 API

• Basic Request Matchers • toHaveBeenRequested • toHaveBeenRequestedTimes • Body Matchers • toHaveBeenRequestedWithBody • toHaveBeenRequestedWithJsonBody • Header Matchers • toHaveBeenRequestedWithHeaders • URL Matchers • toHaveBeenRequestedWithQueryString • toHaveBeenRequestedWithHash • toHaveBeenRequestedWithPathParameters • GraphQL Matchers • toHaveBeenRequestedWithGqlQuery • toHaveBeenRequestedWithGqlVariables • Unified Matcher • toHaveBeenRequestedWith • Nth Call Matchers • Types • RequestPayload

Basic Request Matchers

toHaveBeenRequested

Assert that a handler was called at least once.

toHaveBeenRequestedTimes

Assert that a handler was called exactly n times.

Body Matchers

toHaveBeenRequestedWithBody

Assert on raw request body (string).

toHaveBeenRequestedWithJsonBody

Assert on JSON request body (parsed object).

Header Matchers

toHaveBeenRequestedWithHeaders

Assert on request headers. Headers are case-insensitive.

URL Matchers

toHaveBeenRequestedWithQueryString

Assert on URL query parameters.

[!NOTE] The input is a string to avoid serialization issues, especially with arrays and custom formats. This gives you full control over the exact query string format.

toHaveBeenRequestedWithHash

Assert on URL hash fragment.

toHaveBeenRequestedWithPathParameters

Assert on URL path parameters (for dynamic routes).

GraphQL Matchers

toHaveBeenRequestedWithGqlQuery

Assert on GraphQL query string.

toHaveBeenRequestedWithGqlVariables

Assert on GraphQL variables.

Unified Matcher

toHaveBeenRequestedWith

Assert on multiple request properties at once. See RequestPayload for all available properties.

Nth Call Matchers

All matchers have an "nth" variant to assert on specific call positions. The first argument is the call number (1-indexed).

Types

RequestPayload

The payload object used with toHaveBeenRequestedWith matcher.

🤝 Contributing

Development

Local Development

Build

Release

This repo uses Release Please to release.

To release a new version

1. Merge your changes into the main branch. 2. An automated GitHub Action will run, triggering the creation of a Release PR. 3. Merge the release PR. 4. Wait for the second GitHub Action to run automatically. 5. Congratulations, you're all set!

Description from the npm listing.

  • msw
  • vitest
  • vitest-plugin
  • api
  • mock
  • mocking
  • testing

Where msw-request-assertions sits in the listing

Each band is one page of 20. Weekly downloads on a log scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

All npm2,248 listings · 113 pages · page 77, #5 (overall #1525)
All npm: every listing in weekly downloads order
PNG SVG
Testing21 listings · 2 pages · page 1, #6 (overall #6)
Testing: every listing in weekly downloads order
PNG SVG

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

msw-request-assertions weekly downloads on npm, last 90 days: 374 weekly downloads as of Oct 17, 2026, +40.1% over 90 days.msw-request-assertionsWeekly downloads on npm · Last 90 days374downloads / week+40.1% over 90 days0100200300400500600Jul 19Aug 3Aug 18Sep 2Sep 17Oct 2Oct 17downloads / weekobservedarchived (Internet Archive)no observationsJul 21, 2026 – Oct 17, 2026 · 89 observations · Updated Oc…pluginstats.com
msw-request-assertions weekly downloads on npm, last 90 days: 374 weekly downloads as of Oct 17, 2026, +40.1% over 90 days.
PNG SVG

7/30/90-day growth

msw-request-assertions weekly downloads growth on npm: -9.7% over 7 days, +41.1% over 30 days, +40.1% over 90 days.msw-request-assertionsWeekly downloads growth on npm374downloads / week now7-day growth-40 weekly downloads-9.7%30-day growth+109 weekly downloads+41.1%90-day growth+107 weekly downloads+40.1%Growth vs. nearest observation to each baseline date · Updated Oct 17, 2026pluginstats.com
msw-request-assertions weekly downloads growth on npm: -9.7% over 7 days, +41.1% over 30 days, +40.1% over 90 days.
PNG SVG

Ranking history

msw-request-assertions npm ranking history: currently #1524 (by weekly downloads).msw-request-assertionsnpm ranking · by weekly downloads · Last 90 days#1524current rank#400#600#800#1000#1200#1400#1600Jul 20Aug 4Aug 19Sep 3Sep 18Oct 3Oct 18rankOct 17, 2026 – Oct 18, 2026 · 2 observations · Updated Oct 17, 2026pluginstats.com
msw-request-assertions npm ranking history: currently #1524 (by weekly downloads).
PNG SVG

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Recent observations

Full history (543)
Recent weekly downloads observations for msw-request-assertions
Date (UTC)Weekly downloadsChange vs. previous
374-32
406+5
401-119
520-38
5580
558+150
408-6
414+31
383+114
269+101
168+21
147-22
169-54
223—

Similar npm Testing plugins

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/msw-request-assertions. First seen Oct 16, 2026; last successful collection Oct 18, 2026. See the methodology.