Nanoseconds Produce Minutes
    Wondering what’s next for npm?Check out our public roadmap! »

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

    7.3.3 • Public • Published

    fetch-mock

    Mock http requests made using fetch

    node version licence npm downloads CircleCI Code coverage Known Vulnerabilities

    fetchMock.mock('http://example.com', 200);
    const res = await fetch('http://example.com');
    assert(res.ok);
    fetchMock.restore();

    Table of Contents

    I devote a lot of time to maintaining fetch-mock for free. I don't ask for payment, but am raising money for a refugee charity - please consider donating


    Requirements

    fetch-mock requires the following to run:

    • Node.js 8+ for full feature operation
    • Node.js 0.12+ with limitations
    • npm (normally comes with Node.js)
    • Either of the following
      • node-fetch when testing in a nodejs
      • A browser that supports the fetch API when testing in a browser

    Documentation and Usage

    See the project website

    License

    fetch-mock is licensed under the MIT license. Copyright © 2019, Rhys Evans

    Housekeeping

    npm version maintainability

    Install

    npm i [email protected]

    Version

    7.3.3

    License

    MIT

    Unpacked Size

    1.32 MB

    Total Files

    27

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar