vi-fetch
TypeScript icon, indicating that this package has built-in type declarations

0.8.0 • Public • Published

vi-fetch

Easiest way to mock fetch

Compatible with Vitest and Jest when using ESM flag or with transform for /node_modules/vi-fetch.

The main difference with fetch-mock or fetch-mock-jest is that they consider fetch just as a function call instead of function that calls API endpoints. vi-fetch provides matchers to test calls to endpoints instead of simply function calls.

For example, we consider an endpoint to be a part of URL until the first ?: query is an argument to an endpoint, just like body, - that's why we provide matchers like toHaveFetchedWithQuery and toHaveFetchedWithBody.

Docs

Read full docs on GitHub.

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i vi-fetch

    Weekly Downloads

    15,279

    Version

    0.8.0

    License

    MIT

    Unpacked Size

    39.3 kB

    Total Files

    28

    Last publish

    Collaborators

    • oreanno