fetch-mock

Mock http requests made using fetch

  • 所有者: wheresrhys/fetch-mock
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

fetch-mock

Mock http requests made using fetch.

New If using jest, try the new fetch-mock-jest wrapper.

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

If you're using jest as your test runner, consider using fetch-mock-jest, a lightweight, jest-friendly wrapper around fetch-mock.

License

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

Housekeeping

npm version
maintainability

主要指标

概览
名称与所有者wheresrhys/fetch-mock
主编程语言JavaScript
编程语言JavaScript (语言数: 3)
平台
许可证MIT License
所有者活动
创建于2015-04-30 21:27:58
推送于2025-07-22 12:03:33
最后一次提交
发布数337
最新版本名称vitest-v0.2.14 (发布于 )
第一版名称v1.0.0 (发布于 )
用户参与
星数1.3k
关注者数12
派生数193
提交数2k
已启用问题?
问题数400
打开的问题数7
拉请求数411
打开的拉请求数1
关闭的拉请求数129
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?