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?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?